migrate gplus to google oauth2 provider (#7885)
* migrate gplus to google oauth2 provider. this still provides support for old gplus connections. * Update models/oauth2.go Co-Authored-By: Antoine GIRARD <sapk@users.noreply.github.com> * make vendor
This commit is contained in:
parent
107d57a925
commit
7a8e299c7c
39 changed files with 3992 additions and 63 deletions
2
go.mod
2
go.mod
|
@ -68,8 +68,8 @@ require (
|
||||||
github.com/lib/pq v1.2.0
|
github.com/lib/pq v1.2.0
|
||||||
github.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96
|
github.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96
|
||||||
github.com/lunny/levelqueue v0.0.0-20190217115915-02b525a4418e
|
github.com/lunny/levelqueue v0.0.0-20190217115915-02b525a4418e
|
||||||
github.com/markbates/goth v1.56.0
|
|
||||||
github.com/mailru/easyjson v0.7.0 // indirect
|
github.com/mailru/easyjson v0.7.0 // indirect
|
||||||
|
github.com/markbates/goth v1.56.0
|
||||||
github.com/mattn/go-isatty v0.0.7
|
github.com/mattn/go-isatty v0.0.7
|
||||||
github.com/mattn/go-oci8 v0.0.0-20190320171441-14ba190cf52d // indirect
|
github.com/mattn/go-oci8 v0.0.0-20190320171441-14ba190cf52d // indirect
|
||||||
github.com/mattn/go-sqlite3 v1.11.0
|
github.com/mattn/go-sqlite3 v1.11.0
|
||||||
|
|
|
@ -40,7 +40,7 @@ var OAuth2Providers = map[string]OAuth2Provider{
|
||||||
ProfileURL: oauth2.GetDefaultProfileURL("gitlab"),
|
ProfileURL: oauth2.GetDefaultProfileURL("gitlab"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"gplus": {Name: "gplus", DisplayName: "Google+", Image: "/img/auth/google_plus.png"},
|
"gplus": {Name: "gplus", DisplayName: "Google", Image: "/img/auth/google.png"},
|
||||||
"openidConnect": {Name: "openidConnect", DisplayName: "OpenID Connect", Image: "/img/auth/openid_connect.png"},
|
"openidConnect": {Name: "openidConnect", DisplayName: "OpenID Connect", Image: "/img/auth/openid_connect.png"},
|
||||||
"twitter": {Name: "twitter", DisplayName: "Twitter", Image: "/img/auth/twitter.png"},
|
"twitter": {Name: "twitter", DisplayName: "Twitter", Image: "/img/auth/twitter.png"},
|
||||||
"discord": {Name: "discord", DisplayName: "Discord", Image: "/img/auth/discord.png"},
|
"discord": {Name: "discord", DisplayName: "Discord", Image: "/img/auth/discord.png"},
|
||||||
|
|
|
@ -22,7 +22,7 @@ import (
|
||||||
"github.com/markbates/goth/providers/gitea"
|
"github.com/markbates/goth/providers/gitea"
|
||||||
"github.com/markbates/goth/providers/github"
|
"github.com/markbates/goth/providers/github"
|
||||||
"github.com/markbates/goth/providers/gitlab"
|
"github.com/markbates/goth/providers/gitlab"
|
||||||
"github.com/markbates/goth/providers/gplus"
|
"github.com/markbates/goth/providers/google"
|
||||||
"github.com/markbates/goth/providers/openidConnect"
|
"github.com/markbates/goth/providers/openidConnect"
|
||||||
"github.com/markbates/goth/providers/twitter"
|
"github.com/markbates/goth/providers/twitter"
|
||||||
"github.com/satori/go.uuid"
|
"github.com/satori/go.uuid"
|
||||||
|
@ -166,8 +166,8 @@ func createProvider(providerName, providerType, clientID, clientSecret, openIDCo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
provider = gitlab.NewCustomisedURL(clientID, clientSecret, callbackURL, authURL, tokenURL, profileURL, "read_user")
|
provider = gitlab.NewCustomisedURL(clientID, clientSecret, callbackURL, authURL, tokenURL, profileURL, "read_user")
|
||||||
case "gplus":
|
case "gplus": // named gplus due to legacy gplus -> google migration (Google killed Google+). This ensures old connections still work
|
||||||
provider = gplus.New(clientID, clientSecret, callbackURL, "email")
|
provider = google.New(clientID, clientSecret, callbackURL)
|
||||||
case "openidConnect":
|
case "openidConnect":
|
||||||
if provider, err = openidConnect.New(clientID, clientSecret, callbackURL, openIDConnectAutoDiscoveryURL); err != nil {
|
if provider, err = openidConnect.New(clientID, clientSecret, callbackURL, openIDConnectAutoDiscoveryURL); err != nil {
|
||||||
log.Warn("Failed to create OpenID Connect Provider with name '%s' with url '%s': %v", providerName, openIDConnectAutoDiscoveryURL, err)
|
log.Warn("Failed to create OpenID Connect Provider with name '%s' with url '%s': %v", providerName, openIDConnectAutoDiscoveryURL, err)
|
||||||
|
|
BIN
public/img/auth/google.png
Normal file
BIN
public/img/auth/google.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
|
@ -102,7 +102,7 @@
|
||||||
<span>{{.i18n.Tr "admin.auths.tip.github"}}</span>
|
<span>{{.i18n.Tr "admin.auths.tip.github"}}</span>
|
||||||
<li>GitLab</li>
|
<li>GitLab</li>
|
||||||
<span>{{.i18n.Tr "admin.auths.tip.gitlab"}}</span>
|
<span>{{.i18n.Tr "admin.auths.tip.gitlab"}}</span>
|
||||||
<li>Google+</li>
|
<li>Google</li>
|
||||||
<span>{{.i18n.Tr "admin.auths.tip.google_plus"}}</span>
|
<span>{{.i18n.Tr "admin.auths.tip.google_plus"}}</span>
|
||||||
<li>OpenID Connect</li>
|
<li>OpenID Connect</li>
|
||||||
<span>{{.i18n.Tr "admin.auths.tip.openid_connect"}}</span>
|
<span>{{.i18n.Tr "admin.auths.tip.openid_connect"}}</span>
|
||||||
|
|
526
vendor/cloud.google.com/go/compute/metadata/metadata.go
generated
vendored
Normal file
526
vendor/cloud.google.com/go/compute/metadata/metadata.go
generated
vendored
Normal file
|
@ -0,0 +1,526 @@
|
||||||
|
// Copyright 2014 Google LLC
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
// Package metadata provides access to Google Compute Engine (GCE)
|
||||||
|
// metadata and API service accounts.
|
||||||
|
//
|
||||||
|
// This package is a wrapper around the GCE metadata service,
|
||||||
|
// as documented at https://developers.google.com/compute/docs/metadata.
|
||||||
|
package metadata // import "cloud.google.com/go/compute/metadata"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"net"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"os"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// metadataIP is the documented metadata server IP address.
|
||||||
|
metadataIP = "169.254.169.254"
|
||||||
|
|
||||||
|
// metadataHostEnv is the environment variable specifying the
|
||||||
|
// GCE metadata hostname. If empty, the default value of
|
||||||
|
// metadataIP ("169.254.169.254") is used instead.
|
||||||
|
// This is variable name is not defined by any spec, as far as
|
||||||
|
// I know; it was made up for the Go package.
|
||||||
|
metadataHostEnv = "GCE_METADATA_HOST"
|
||||||
|
|
||||||
|
userAgent = "gcloud-golang/0.1"
|
||||||
|
)
|
||||||
|
|
||||||
|
type cachedValue struct {
|
||||||
|
k string
|
||||||
|
trim bool
|
||||||
|
mu sync.Mutex
|
||||||
|
v string
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
projID = &cachedValue{k: "project/project-id", trim: true}
|
||||||
|
projNum = &cachedValue{k: "project/numeric-project-id", trim: true}
|
||||||
|
instID = &cachedValue{k: "instance/id", trim: true}
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
defaultClient = &Client{hc: &http.Client{
|
||||||
|
Transport: &http.Transport{
|
||||||
|
Dial: (&net.Dialer{
|
||||||
|
Timeout: 2 * time.Second,
|
||||||
|
KeepAlive: 30 * time.Second,
|
||||||
|
}).Dial,
|
||||||
|
ResponseHeaderTimeout: 2 * time.Second,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
subscribeClient = &Client{hc: &http.Client{
|
||||||
|
Transport: &http.Transport{
|
||||||
|
Dial: (&net.Dialer{
|
||||||
|
Timeout: 2 * time.Second,
|
||||||
|
KeepAlive: 30 * time.Second,
|
||||||
|
}).Dial,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
)
|
||||||
|
|
||||||
|
// NotDefinedError is returned when requested metadata is not defined.
|
||||||
|
//
|
||||||
|
// The underlying string is the suffix after "/computeMetadata/v1/".
|
||||||
|
//
|
||||||
|
// This error is not returned if the value is defined to be the empty
|
||||||
|
// string.
|
||||||
|
type NotDefinedError string
|
||||||
|
|
||||||
|
func (suffix NotDefinedError) Error() string {
|
||||||
|
return fmt.Sprintf("metadata: GCE metadata %q not defined", string(suffix))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cachedValue) get(cl *Client) (v string, err error) {
|
||||||
|
defer c.mu.Unlock()
|
||||||
|
c.mu.Lock()
|
||||||
|
if c.v != "" {
|
||||||
|
return c.v, nil
|
||||||
|
}
|
||||||
|
if c.trim {
|
||||||
|
v, err = cl.getTrimmed(c.k)
|
||||||
|
} else {
|
||||||
|
v, err = cl.Get(c.k)
|
||||||
|
}
|
||||||
|
if err == nil {
|
||||||
|
c.v = v
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
onGCEOnce sync.Once
|
||||||
|
onGCE bool
|
||||||
|
)
|
||||||
|
|
||||||
|
// OnGCE reports whether this process is running on Google Compute Engine.
|
||||||
|
func OnGCE() bool {
|
||||||
|
onGCEOnce.Do(initOnGCE)
|
||||||
|
return onGCE
|
||||||
|
}
|
||||||
|
|
||||||
|
func initOnGCE() {
|
||||||
|
onGCE = testOnGCE()
|
||||||
|
}
|
||||||
|
|
||||||
|
func testOnGCE() bool {
|
||||||
|
// The user explicitly said they're on GCE, so trust them.
|
||||||
|
if os.Getenv(metadataHostEnv) != "" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
resc := make(chan bool, 2)
|
||||||
|
|
||||||
|
// Try two strategies in parallel.
|
||||||
|
// See https://github.com/googleapis/google-cloud-go/issues/194
|
||||||
|
go func() {
|
||||||
|
req, _ := http.NewRequest("GET", "http://"+metadataIP, nil)
|
||||||
|
req.Header.Set("User-Agent", userAgent)
|
||||||
|
res, err := defaultClient.hc.Do(req.WithContext(ctx))
|
||||||
|
if err != nil {
|
||||||
|
resc <- false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer res.Body.Close()
|
||||||
|
resc <- res.Header.Get("Metadata-Flavor") == "Google"
|
||||||
|
}()
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
addrs, err := net.LookupHost("metadata.google.internal")
|
||||||
|
if err != nil || len(addrs) == 0 {
|
||||||
|
resc <- false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resc <- strsContains(addrs, metadataIP)
|
||||||
|
}()
|
||||||
|
|
||||||
|
tryHarder := systemInfoSuggestsGCE()
|
||||||
|
if tryHarder {
|
||||||
|
res := <-resc
|
||||||
|
if res {
|
||||||
|
// The first strategy succeeded, so let's use it.
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// Wait for either the DNS or metadata server probe to
|
||||||
|
// contradict the other one and say we are running on
|
||||||
|
// GCE. Give it a lot of time to do so, since the system
|
||||||
|
// info already suggests we're running on a GCE BIOS.
|
||||||
|
timer := time.NewTimer(5 * time.Second)
|
||||||
|
defer timer.Stop()
|
||||||
|
select {
|
||||||
|
case res = <-resc:
|
||||||
|
return res
|
||||||
|
case <-timer.C:
|
||||||
|
// Too slow. Who knows what this system is.
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// There's no hint from the system info that we're running on
|
||||||
|
// GCE, so use the first probe's result as truth, whether it's
|
||||||
|
// true or false. The goal here is to optimize for speed for
|
||||||
|
// users who are NOT running on GCE. We can't assume that
|
||||||
|
// either a DNS lookup or an HTTP request to a blackholed IP
|
||||||
|
// address is fast. Worst case this should return when the
|
||||||
|
// metaClient's Transport.ResponseHeaderTimeout or
|
||||||
|
// Transport.Dial.Timeout fires (in two seconds).
|
||||||
|
return <-resc
|
||||||
|
}
|
||||||
|
|
||||||
|
// systemInfoSuggestsGCE reports whether the local system (without
|
||||||
|
// doing network requests) suggests that we're running on GCE. If this
|
||||||
|
// returns true, testOnGCE tries a bit harder to reach its metadata
|
||||||
|
// server.
|
||||||
|
func systemInfoSuggestsGCE() bool {
|
||||||
|
if runtime.GOOS != "linux" {
|
||||||
|
// We don't have any non-Linux clues available, at least yet.
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
slurp, _ := ioutil.ReadFile("/sys/class/dmi/id/product_name")
|
||||||
|
name := strings.TrimSpace(string(slurp))
|
||||||
|
return name == "Google" || name == "Google Compute Engine"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Subscribe calls Client.Subscribe on a client designed for subscribing (one with no
|
||||||
|
// ResponseHeaderTimeout).
|
||||||
|
func Subscribe(suffix string, fn func(v string, ok bool) error) error {
|
||||||
|
return subscribeClient.Subscribe(suffix, fn)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get calls Client.Get on the default client.
|
||||||
|
func Get(suffix string) (string, error) { return defaultClient.Get(suffix) }
|
||||||
|
|
||||||
|
// ProjectID returns the current instance's project ID string.
|
||||||
|
func ProjectID() (string, error) { return defaultClient.ProjectID() }
|
||||||
|
|
||||||
|
// NumericProjectID returns the current instance's numeric project ID.
|
||||||
|
func NumericProjectID() (string, error) { return defaultClient.NumericProjectID() }
|
||||||
|
|
||||||
|
// InternalIP returns the instance's primary internal IP address.
|
||||||
|
func InternalIP() (string, error) { return defaultClient.InternalIP() }
|
||||||
|
|
||||||
|
// ExternalIP returns the instance's primary external (public) IP address.
|
||||||
|
func ExternalIP() (string, error) { return defaultClient.ExternalIP() }
|
||||||
|
|
||||||
|
// Email calls Client.Email on the default client.
|
||||||
|
func Email(serviceAccount string) (string, error) { return defaultClient.Email(serviceAccount) }
|
||||||
|
|
||||||
|
// Hostname returns the instance's hostname. This will be of the form
|
||||||
|
// "<instanceID>.c.<projID>.internal".
|
||||||
|
func Hostname() (string, error) { return defaultClient.Hostname() }
|
||||||
|
|
||||||
|
// InstanceTags returns the list of user-defined instance tags,
|
||||||
|
// assigned when initially creating a GCE instance.
|
||||||
|
func InstanceTags() ([]string, error) { return defaultClient.InstanceTags() }
|
||||||
|
|
||||||
|
// InstanceID returns the current VM's numeric instance ID.
|
||||||
|
func InstanceID() (string, error) { return defaultClient.InstanceID() }
|
||||||
|
|
||||||
|
// InstanceName returns the current VM's instance ID string.
|
||||||
|
func InstanceName() (string, error) { return defaultClient.InstanceName() }
|
||||||
|
|
||||||
|
// Zone returns the current VM's zone, such as "us-central1-b".
|
||||||
|
func Zone() (string, error) { return defaultClient.Zone() }
|
||||||
|
|
||||||
|
// InstanceAttributes calls Client.InstanceAttributes on the default client.
|
||||||
|
func InstanceAttributes() ([]string, error) { return defaultClient.InstanceAttributes() }
|
||||||
|
|
||||||
|
// ProjectAttributes calls Client.ProjectAttributes on the default client.
|
||||||
|
func ProjectAttributes() ([]string, error) { return defaultClient.ProjectAttributes() }
|
||||||
|
|
||||||
|
// InstanceAttributeValue calls Client.InstanceAttributeValue on the default client.
|
||||||
|
func InstanceAttributeValue(attr string) (string, error) {
|
||||||
|
return defaultClient.InstanceAttributeValue(attr)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ProjectAttributeValue calls Client.ProjectAttributeValue on the default client.
|
||||||
|
func ProjectAttributeValue(attr string) (string, error) {
|
||||||
|
return defaultClient.ProjectAttributeValue(attr)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scopes calls Client.Scopes on the default client.
|
||||||
|
func Scopes(serviceAccount string) ([]string, error) { return defaultClient.Scopes(serviceAccount) }
|
||||||
|
|
||||||
|
func strsContains(ss []string, s string) bool {
|
||||||
|
for _, v := range ss {
|
||||||
|
if v == s {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// A Client provides metadata.
|
||||||
|
type Client struct {
|
||||||
|
hc *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewClient returns a Client that can be used to fetch metadata. All HTTP requests
|
||||||
|
// will use the given http.Client instead of the default client.
|
||||||
|
func NewClient(c *http.Client) *Client {
|
||||||
|
return &Client{hc: c}
|
||||||
|
}
|
||||||
|
|
||||||
|
// getETag returns a value from the metadata service as well as the associated ETag.
|
||||||
|
// This func is otherwise equivalent to Get.
|
||||||
|
func (c *Client) getETag(suffix string) (value, etag string, err error) {
|
||||||
|
// Using a fixed IP makes it very difficult to spoof the metadata service in
|
||||||
|
// a container, which is an important use-case for local testing of cloud
|
||||||
|
// deployments. To enable spoofing of the metadata service, the environment
|
||||||
|
// variable GCE_METADATA_HOST is first inspected to decide where metadata
|
||||||
|
// requests shall go.
|
||||||
|
host := os.Getenv(metadataHostEnv)
|
||||||
|
if host == "" {
|
||||||
|
// Using 169.254.169.254 instead of "metadata" here because Go
|
||||||
|
// binaries built with the "netgo" tag and without cgo won't
|
||||||
|
// know the search suffix for "metadata" is
|
||||||
|
// ".google.internal", and this IP address is documented as
|
||||||
|
// being stable anyway.
|
||||||
|
host = metadataIP
|
||||||
|
}
|
||||||
|
u := "http://" + host + "/computeMetadata/v1/" + suffix
|
||||||
|
req, _ := http.NewRequest("GET", u, nil)
|
||||||
|
req.Header.Set("Metadata-Flavor", "Google")
|
||||||
|
req.Header.Set("User-Agent", userAgent)
|
||||||
|
res, err := c.hc.Do(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", "", err
|
||||||
|
}
|
||||||
|
defer res.Body.Close()
|
||||||
|
if res.StatusCode == http.StatusNotFound {
|
||||||
|
return "", "", NotDefinedError(suffix)
|
||||||
|
}
|
||||||
|
all, err := ioutil.ReadAll(res.Body)
|
||||||
|
if err != nil {
|
||||||
|
return "", "", err
|
||||||
|
}
|
||||||
|
if res.StatusCode != 200 {
|
||||||
|
return "", "", &Error{Code: res.StatusCode, Message: string(all)}
|
||||||
|
}
|
||||||
|
return string(all), res.Header.Get("Etag"), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get returns a value from the metadata service.
|
||||||
|
// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/".
|
||||||
|
//
|
||||||
|
// If the GCE_METADATA_HOST environment variable is not defined, a default of
|
||||||
|
// 169.254.169.254 will be used instead.
|
||||||
|
//
|
||||||
|
// If the requested metadata is not defined, the returned error will
|
||||||
|
// be of type NotDefinedError.
|
||||||
|
func (c *Client) Get(suffix string) (string, error) {
|
||||||
|
val, _, err := c.getETag(suffix)
|
||||||
|
return val, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) getTrimmed(suffix string) (s string, err error) {
|
||||||
|
s, err = c.Get(suffix)
|
||||||
|
s = strings.TrimSpace(s)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) lines(suffix string) ([]string, error) {
|
||||||
|
j, err := c.Get(suffix)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
s := strings.Split(strings.TrimSpace(j), "\n")
|
||||||
|
for i := range s {
|
||||||
|
s[i] = strings.TrimSpace(s[i])
|
||||||
|
}
|
||||||
|
return s, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ProjectID returns the current instance's project ID string.
|
||||||
|
func (c *Client) ProjectID() (string, error) { return projID.get(c) }
|
||||||
|
|
||||||
|
// NumericProjectID returns the current instance's numeric project ID.
|
||||||
|
func (c *Client) NumericProjectID() (string, error) { return projNum.get(c) }
|
||||||
|
|
||||||
|
// InstanceID returns the current VM's numeric instance ID.
|
||||||
|
func (c *Client) InstanceID() (string, error) { return instID.get(c) }
|
||||||
|
|
||||||
|
// InternalIP returns the instance's primary internal IP address.
|
||||||
|
func (c *Client) InternalIP() (string, error) {
|
||||||
|
return c.getTrimmed("instance/network-interfaces/0/ip")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Email returns the email address associated with the service account.
|
||||||
|
// The account may be empty or the string "default" to use the instance's
|
||||||
|
// main account.
|
||||||
|
func (c *Client) Email(serviceAccount string) (string, error) {
|
||||||
|
if serviceAccount == "" {
|
||||||
|
serviceAccount = "default"
|
||||||
|
}
|
||||||
|
return c.getTrimmed("instance/service-accounts/" + serviceAccount + "/email")
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExternalIP returns the instance's primary external (public) IP address.
|
||||||
|
func (c *Client) ExternalIP() (string, error) {
|
||||||
|
return c.getTrimmed("instance/network-interfaces/0/access-configs/0/external-ip")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hostname returns the instance's hostname. This will be of the form
|
||||||
|
// "<instanceID>.c.<projID>.internal".
|
||||||
|
func (c *Client) Hostname() (string, error) {
|
||||||
|
return c.getTrimmed("instance/hostname")
|
||||||
|
}
|
||||||
|
|
||||||
|
// InstanceTags returns the list of user-defined instance tags,
|
||||||
|
// assigned when initially creating a GCE instance.
|
||||||
|
func (c *Client) InstanceTags() ([]string, error) {
|
||||||
|
var s []string
|
||||||
|
j, err := c.Get("instance/tags")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if err := json.NewDecoder(strings.NewReader(j)).Decode(&s); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return s, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// InstanceName returns the current VM's instance ID string.
|
||||||
|
func (c *Client) InstanceName() (string, error) {
|
||||||
|
host, err := c.Hostname()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return strings.Split(host, ".")[0], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zone returns the current VM's zone, such as "us-central1-b".
|
||||||
|
func (c *Client) Zone() (string, error) {
|
||||||
|
zone, err := c.getTrimmed("instance/zone")
|
||||||
|
// zone is of the form "projects/<projNum>/zones/<zoneName>".
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return zone[strings.LastIndex(zone, "/")+1:], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// InstanceAttributes returns the list of user-defined attributes,
|
||||||
|
// assigned when initially creating a GCE VM instance. The value of an
|
||||||
|
// attribute can be obtained with InstanceAttributeValue.
|
||||||
|
func (c *Client) InstanceAttributes() ([]string, error) { return c.lines("instance/attributes/") }
|
||||||
|
|
||||||
|
// ProjectAttributes returns the list of user-defined attributes
|
||||||
|
// applying to the project as a whole, not just this VM. The value of
|
||||||
|
// an attribute can be obtained with ProjectAttributeValue.
|
||||||
|
func (c *Client) ProjectAttributes() ([]string, error) { return c.lines("project/attributes/") }
|
||||||
|
|
||||||
|
// InstanceAttributeValue returns the value of the provided VM
|
||||||
|
// instance attribute.
|
||||||
|
//
|
||||||
|
// If the requested attribute is not defined, the returned error will
|
||||||
|
// be of type NotDefinedError.
|
||||||
|
//
|
||||||
|
// InstanceAttributeValue may return ("", nil) if the attribute was
|
||||||
|
// defined to be the empty string.
|
||||||
|
func (c *Client) InstanceAttributeValue(attr string) (string, error) {
|
||||||
|
return c.Get("instance/attributes/" + attr)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ProjectAttributeValue returns the value of the provided
|
||||||
|
// project attribute.
|
||||||
|
//
|
||||||
|
// If the requested attribute is not defined, the returned error will
|
||||||
|
// be of type NotDefinedError.
|
||||||
|
//
|
||||||
|
// ProjectAttributeValue may return ("", nil) if the attribute was
|
||||||
|
// defined to be the empty string.
|
||||||
|
func (c *Client) ProjectAttributeValue(attr string) (string, error) {
|
||||||
|
return c.Get("project/attributes/" + attr)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scopes returns the service account scopes for the given account.
|
||||||
|
// The account may be empty or the string "default" to use the instance's
|
||||||
|
// main account.
|
||||||
|
func (c *Client) Scopes(serviceAccount string) ([]string, error) {
|
||||||
|
if serviceAccount == "" {
|
||||||
|
serviceAccount = "default"
|
||||||
|
}
|
||||||
|
return c.lines("instance/service-accounts/" + serviceAccount + "/scopes")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Subscribe subscribes to a value from the metadata service.
|
||||||
|
// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/".
|
||||||
|
// The suffix may contain query parameters.
|
||||||
|
//
|
||||||
|
// Subscribe calls fn with the latest metadata value indicated by the provided
|
||||||
|
// suffix. If the metadata value is deleted, fn is called with the empty string
|
||||||
|
// and ok false. Subscribe blocks until fn returns a non-nil error or the value
|
||||||
|
// is deleted. Subscribe returns the error value returned from the last call to
|
||||||
|
// fn, which may be nil when ok == false.
|
||||||
|
func (c *Client) Subscribe(suffix string, fn func(v string, ok bool) error) error {
|
||||||
|
const failedSubscribeSleep = time.Second * 5
|
||||||
|
|
||||||
|
// First check to see if the metadata value exists at all.
|
||||||
|
val, lastETag, err := c.getETag(suffix)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := fn(val, true); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
ok := true
|
||||||
|
if strings.ContainsRune(suffix, '?') {
|
||||||
|
suffix += "&wait_for_change=true&last_etag="
|
||||||
|
} else {
|
||||||
|
suffix += "?wait_for_change=true&last_etag="
|
||||||
|
}
|
||||||
|
for {
|
||||||
|
val, etag, err := c.getETag(suffix + url.QueryEscape(lastETag))
|
||||||
|
if err != nil {
|
||||||
|
if _, deleted := err.(NotDefinedError); !deleted {
|
||||||
|
time.Sleep(failedSubscribeSleep)
|
||||||
|
continue // Retry on other errors.
|
||||||
|
}
|
||||||
|
ok = false
|
||||||
|
}
|
||||||
|
lastETag = etag
|
||||||
|
|
||||||
|
if err := fn(val, ok); err != nil || !ok {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error contains an error response from the server.
|
||||||
|
type Error struct {
|
||||||
|
// Code is the HTTP response status code.
|
||||||
|
Code int
|
||||||
|
// Message is the server response message.
|
||||||
|
Message string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Error) Error() string {
|
||||||
|
return fmt.Sprintf("compute: Received %d `%s`", e.Code, e.Message)
|
||||||
|
}
|
10
vendor/github.com/markbates/goth/providers/google/endpoint.go
generated
vendored
Normal file
10
vendor/github.com/markbates/goth/providers/google/endpoint.go
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
// +build go1.9
|
||||||
|
|
||||||
|
package google
|
||||||
|
|
||||||
|
import (
|
||||||
|
goog "golang.org/x/oauth2/google"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Endpoint is Google's OAuth 2.0 endpoint.
|
||||||
|
var Endpoint = goog.Endpoint
|
13
vendor/github.com/markbates/goth/providers/google/endpoint_legacy.go
generated
vendored
Normal file
13
vendor/github.com/markbates/goth/providers/google/endpoint_legacy.go
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
// +build !go1.9
|
||||||
|
|
||||||
|
package google
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golang.org/x/oauth2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Endpoint is Google's OAuth 2.0 endpoint.
|
||||||
|
var Endpoint = oauth2.Endpoint{
|
||||||
|
AuthURL: "https://accounts.google.com/o/oauth2/auth",
|
||||||
|
TokenURL: "https://accounts.google.com/o/oauth2/token",
|
||||||
|
}
|
|
@ -1,42 +1,36 @@
|
||||||
// Package gplus implements the OAuth2 protocol for authenticating users through Google+.
|
// Package google implements the OAuth2 protocol for authenticating users
|
||||||
// This package can be used as a reference implementation of an OAuth2 provider for Goth.
|
// through Google.
|
||||||
package gplus
|
package google
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"fmt"
|
|
||||||
"github.com/markbates/goth"
|
"github.com/markbates/goth"
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const endpointProfile string = "https://www.googleapis.com/oauth2/v2/userinfo"
|
||||||
authURL string = "https://accounts.google.com/o/oauth2/auth?access_type=offline"
|
|
||||||
tokenURL string = "https://accounts.google.com/o/oauth2/token"
|
|
||||||
endpointProfile string = "https://www.googleapis.com/oauth2/v2/userinfo"
|
|
||||||
)
|
|
||||||
|
|
||||||
// New creates a new Google+ provider, and sets up important connection details.
|
// New creates a new Google provider, and sets up important connection details.
|
||||||
// You should always call `gplus.New` to get a new Provider. Never try to create
|
// You should always call `google.New` to get a new Provider. Never try to create
|
||||||
// one manually.
|
// one manually.
|
||||||
func New(clientKey, secret, callbackURL string, scopes ...string) *Provider {
|
func New(clientKey, secret, callbackURL string, scopes ...string) *Provider {
|
||||||
p := &Provider{
|
p := &Provider{
|
||||||
ClientKey: clientKey,
|
ClientKey: clientKey,
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
CallbackURL: callbackURL,
|
CallbackURL: callbackURL,
|
||||||
providerName: "gplus",
|
providerName: "google",
|
||||||
}
|
}
|
||||||
p.config = newConfig(p, scopes)
|
p.config = newConfig(p, scopes)
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
// Provider is the implementation of `goth.Provider` for accessing Google+.
|
// Provider is the implementation of `goth.Provider` for accessing Google.
|
||||||
type Provider struct {
|
type Provider struct {
|
||||||
ClientKey string
|
ClientKey string
|
||||||
Secret string
|
Secret string
|
||||||
|
@ -57,14 +51,15 @@ func (p *Provider) SetName(name string) {
|
||||||
p.providerName = name
|
p.providerName = name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client returns an HTTP client to be used in all fetch operations.
|
||||||
func (p *Provider) Client() *http.Client {
|
func (p *Provider) Client() *http.Client {
|
||||||
return goth.HTTPClientWithFallBack(p.HTTPClient)
|
return goth.HTTPClientWithFallBack(p.HTTPClient)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug is a no-op for the gplus package.
|
// Debug is a no-op for the google package.
|
||||||
func (p *Provider) Debug(debug bool) {}
|
func (p *Provider) Debug(debug bool) {}
|
||||||
|
|
||||||
// BeginAuth asks Google+ for an authentication end-point.
|
// BeginAuth asks Google for an authentication endpoint.
|
||||||
func (p *Provider) BeginAuth(state string) (goth.Session, error) {
|
func (p *Provider) BeginAuth(state string) (goth.Session, error) {
|
||||||
var opts []oauth2.AuthCodeOption
|
var opts []oauth2.AuthCodeOption
|
||||||
if p.prompt != nil {
|
if p.prompt != nil {
|
||||||
|
@ -77,7 +72,17 @@ func (p *Provider) BeginAuth(state string) (goth.Session, error) {
|
||||||
return session, nil
|
return session, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FetchUser will go to Google+ and access basic information about the user.
|
type googleUser struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Email string `json:"email"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
FirstName string `json:"given_name"`
|
||||||
|
LastName string `json:"family_name"`
|
||||||
|
Link string `json:"link"`
|
||||||
|
Picture string `json:"picture"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// FetchUser will go to Google and access basic information about the user.
|
||||||
func (p *Provider) FetchUser(session goth.Session) (goth.User, error) {
|
func (p *Provider) FetchUser(session goth.Session) (goth.User, error) {
|
||||||
sess := session.(*Session)
|
sess := session.(*Session)
|
||||||
user := goth.User{
|
user := goth.User{
|
||||||
|
@ -88,7 +93,7 @@ func (p *Provider) FetchUser(session goth.Session) (goth.User, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if user.AccessToken == "" {
|
if user.AccessToken == "" {
|
||||||
// data is not yet retrieved since accessToken is still empty
|
// Data is not yet retrieved, since accessToken is still empty.
|
||||||
return user, fmt.Errorf("%s cannot get user information without accessToken", p.providerName)
|
return user, fmt.Errorf("%s cannot get user information without accessToken", p.providerName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,47 +107,30 @@ func (p *Provider) FetchUser(session goth.Session) (goth.User, error) {
|
||||||
return user, fmt.Errorf("%s responded with a %d trying to fetch user information", p.providerName, response.StatusCode)
|
return user, fmt.Errorf("%s responded with a %d trying to fetch user information", p.providerName, response.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
bits, err := ioutil.ReadAll(response.Body)
|
responseBytes, err := ioutil.ReadAll(response.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return user, err
|
return user, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.NewDecoder(bytes.NewReader(bits)).Decode(&user.RawData)
|
var u googleUser
|
||||||
if err != nil {
|
if err := json.Unmarshal(responseBytes, &u); err != nil {
|
||||||
return user, err
|
return user, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = userFromReader(bytes.NewReader(bits), &user)
|
// Extract the user data we got from Google into our goth.User.
|
||||||
return user, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func userFromReader(reader io.Reader, user *goth.User) error {
|
|
||||||
u := struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
Email string `json:"email"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
FirstName string `json:"given_name"`
|
|
||||||
LastName string `json:"family_name"`
|
|
||||||
Link string `json:"link"`
|
|
||||||
Picture string `json:"picture"`
|
|
||||||
}{}
|
|
||||||
|
|
||||||
err := json.NewDecoder(reader).Decode(&u)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
user.Name = u.Name
|
user.Name = u.Name
|
||||||
user.FirstName = u.FirstName
|
user.FirstName = u.FirstName
|
||||||
user.LastName = u.LastName
|
user.LastName = u.LastName
|
||||||
user.NickName = u.Name
|
user.NickName = u.Name
|
||||||
user.Email = u.Email
|
user.Email = u.Email
|
||||||
//user.Description = u.Bio
|
|
||||||
user.AvatarURL = u.Picture
|
user.AvatarURL = u.Picture
|
||||||
user.UserID = u.ID
|
user.UserID = u.ID
|
||||||
//user.Location = u.Location.Name
|
// Google provides other useful fields such as 'hd'; get them from RawData
|
||||||
|
if err := json.Unmarshal(responseBytes, &user.RawData); err != nil {
|
||||||
|
return user, err
|
||||||
|
}
|
||||||
|
|
||||||
return err
|
return user, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newConfig(provider *Provider, scopes []string) *oauth2.Config {
|
func newConfig(provider *Provider, scopes []string) *oauth2.Config {
|
||||||
|
@ -150,10 +138,7 @@ func newConfig(provider *Provider, scopes []string) *oauth2.Config {
|
||||||
ClientID: provider.ClientKey,
|
ClientID: provider.ClientKey,
|
||||||
ClientSecret: provider.Secret,
|
ClientSecret: provider.Secret,
|
||||||
RedirectURL: provider.CallbackURL,
|
RedirectURL: provider.CallbackURL,
|
||||||
Endpoint: oauth2.Endpoint{
|
Endpoint: Endpoint,
|
||||||
AuthURL: authURL,
|
|
||||||
TokenURL: tokenURL,
|
|
||||||
},
|
|
||||||
Scopes: []string{},
|
Scopes: []string{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +147,7 @@ func newConfig(provider *Provider, scopes []string) *oauth2.Config {
|
||||||
c.Scopes = append(c.Scopes, scope)
|
c.Scopes = append(c.Scopes, scope)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
c.Scopes = []string{"profile", "email", "openid"}
|
c.Scopes = []string{"email"}
|
||||||
}
|
}
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
@ -183,7 +168,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
|
||||||
return newToken, err
|
return newToken, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPrompt sets the prompt values for the GPlus OAuth call. Use this to
|
// SetPrompt sets the prompt values for the google OAuth call. Use this to
|
||||||
// force users to choose and account every time by passing "select_account",
|
// force users to choose and account every time by passing "select_account",
|
||||||
// for example.
|
// for example.
|
||||||
// See https://developers.google.com/identity/protocols/OpenIDConnect#authenticationuriparameters
|
// See https://developers.google.com/identity/protocols/OpenIDConnect#authenticationuriparameters
|
|
@ -1,4 +1,4 @@
|
||||||
package gplus
|
package google
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
@ -9,7 +9,7 @@ import (
|
||||||
"github.com/markbates/goth"
|
"github.com/markbates/goth"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Session stores data during the auth process with Google+.
|
// Session stores data during the auth process with Google.
|
||||||
type Session struct {
|
type Session struct {
|
||||||
AuthURL string
|
AuthURL string
|
||||||
AccessToken string
|
AccessToken string
|
||||||
|
@ -17,7 +17,7 @@ type Session struct {
|
||||||
ExpiresAt time.Time
|
ExpiresAt time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAuthURL will return the URL set by calling the `BeginAuth` function on the Google+ provider.
|
// GetAuthURL will return the URL set by calling the `BeginAuth` function on the Google provider.
|
||||||
func (s Session) GetAuthURL() (string, error) {
|
func (s Session) GetAuthURL() (string, error) {
|
||||||
if s.AuthURL == "" {
|
if s.AuthURL == "" {
|
||||||
return "", errors.New(goth.NoAuthUrlErrorMessage)
|
return "", errors.New(goth.NoAuthUrlErrorMessage)
|
||||||
|
@ -25,7 +25,7 @@ func (s Session) GetAuthURL() (string, error) {
|
||||||
return s.AuthURL, nil
|
return s.AuthURL, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Authorize the session with Google+ and return the access token to be stored for future use.
|
// Authorize the session with Google and return the access token to be stored for future use.
|
||||||
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
|
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
|
||||||
p := provider.(*Provider)
|
p := provider.(*Provider)
|
||||||
token, err := p.config.Exchange(goth.ContextForClient(p.Client()), params.Get("code"))
|
token, err := p.config.Exchange(goth.ContextForClient(p.Client()), params.Get("code"))
|
38
vendor/golang.org/x/oauth2/google/appengine.go
generated
vendored
Normal file
38
vendor/golang.org/x/oauth2/google/appengine.go
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
// Copyright 2014 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package google
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/oauth2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Set at init time by appengine_gen1.go. If nil, we're not on App Engine standard first generation (<= Go 1.9) or App Engine flexible.
|
||||||
|
var appengineTokenFunc func(c context.Context, scopes ...string) (token string, expiry time.Time, err error)
|
||||||
|
|
||||||
|
// Set at init time by appengine_gen1.go. If nil, we're not on App Engine standard first generation (<= Go 1.9) or App Engine flexible.
|
||||||
|
var appengineAppIDFunc func(c context.Context) string
|
||||||
|
|
||||||
|
// AppEngineTokenSource returns a token source that fetches tokens from either
|
||||||
|
// the current application's service account or from the metadata server,
|
||||||
|
// depending on the App Engine environment. See below for environment-specific
|
||||||
|
// details. If you are implementing a 3-legged OAuth 2.0 flow on App Engine that
|
||||||
|
// involves user accounts, see oauth2.Config instead.
|
||||||
|
//
|
||||||
|
// First generation App Engine runtimes (<= Go 1.9):
|
||||||
|
// AppEngineTokenSource returns a token source that fetches tokens issued to the
|
||||||
|
// current App Engine application's service account. The provided context must have
|
||||||
|
// come from appengine.NewContext.
|
||||||
|
//
|
||||||
|
// Second generation App Engine runtimes (>= Go 1.11) and App Engine flexible:
|
||||||
|
// AppEngineTokenSource is DEPRECATED on second generation runtimes and on the
|
||||||
|
// flexible environment. It delegates to ComputeTokenSource, and the provided
|
||||||
|
// context and scopes are not used. Please use DefaultTokenSource (or ComputeTokenSource,
|
||||||
|
// which DefaultTokenSource will use in this case) instead.
|
||||||
|
func AppEngineTokenSource(ctx context.Context, scope ...string) oauth2.TokenSource {
|
||||||
|
return appEngineTokenSource(ctx, scope...)
|
||||||
|
}
|
77
vendor/golang.org/x/oauth2/google/appengine_gen1.go
generated
vendored
Normal file
77
vendor/golang.org/x/oauth2/google/appengine_gen1.go
generated
vendored
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build appengine
|
||||||
|
|
||||||
|
// This file applies to App Engine first generation runtimes (<= Go 1.9).
|
||||||
|
|
||||||
|
package google
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"sort"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"golang.org/x/oauth2"
|
||||||
|
"google.golang.org/appengine"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
appengineTokenFunc = appengine.AccessToken
|
||||||
|
appengineAppIDFunc = appengine.AppID
|
||||||
|
}
|
||||||
|
|
||||||
|
// See comment on AppEngineTokenSource in appengine.go.
|
||||||
|
func appEngineTokenSource(ctx context.Context, scope ...string) oauth2.TokenSource {
|
||||||
|
scopes := append([]string{}, scope...)
|
||||||
|
sort.Strings(scopes)
|
||||||
|
return &gaeTokenSource{
|
||||||
|
ctx: ctx,
|
||||||
|
scopes: scopes,
|
||||||
|
key: strings.Join(scopes, " "),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// aeTokens helps the fetched tokens to be reused until their expiration.
|
||||||
|
var (
|
||||||
|
aeTokensMu sync.Mutex
|
||||||
|
aeTokens = make(map[string]*tokenLock) // key is space-separated scopes
|
||||||
|
)
|
||||||
|
|
||||||
|
type tokenLock struct {
|
||||||
|
mu sync.Mutex // guards t; held while fetching or updating t
|
||||||
|
t *oauth2.Token
|
||||||
|
}
|
||||||
|
|
||||||
|
type gaeTokenSource struct {
|
||||||
|
ctx context.Context
|
||||||
|
scopes []string
|
||||||
|
key string // to aeTokens map; space-separated scopes
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ts *gaeTokenSource) Token() (*oauth2.Token, error) {
|
||||||
|
aeTokensMu.Lock()
|
||||||
|
tok, ok := aeTokens[ts.key]
|
||||||
|
if !ok {
|
||||||
|
tok = &tokenLock{}
|
||||||
|
aeTokens[ts.key] = tok
|
||||||
|
}
|
||||||
|
aeTokensMu.Unlock()
|
||||||
|
|
||||||
|
tok.mu.Lock()
|
||||||
|
defer tok.mu.Unlock()
|
||||||
|
if tok.t.Valid() {
|
||||||
|
return tok.t, nil
|
||||||
|
}
|
||||||
|
access, exp, err := appengineTokenFunc(ts.ctx, ts.scopes...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
tok.t = &oauth2.Token{
|
||||||
|
AccessToken: access,
|
||||||
|
Expiry: exp,
|
||||||
|
}
|
||||||
|
return tok.t, nil
|
||||||
|
}
|
27
vendor/golang.org/x/oauth2/google/appengine_gen2_flex.go
generated
vendored
Normal file
27
vendor/golang.org/x/oauth2/google/appengine_gen2_flex.go
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !appengine
|
||||||
|
|
||||||
|
// This file applies to App Engine second generation runtimes (>= Go 1.11) and App Engine flexible.
|
||||||
|
|
||||||
|
package google
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"log"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"golang.org/x/oauth2"
|
||||||
|
)
|
||||||
|
|
||||||
|
var logOnce sync.Once // only spam about deprecation once
|
||||||
|
|
||||||
|
// See comment on AppEngineTokenSource in appengine.go.
|
||||||
|
func appEngineTokenSource(ctx context.Context, scope ...string) oauth2.TokenSource {
|
||||||
|
logOnce.Do(func() {
|
||||||
|
log.Print("google: AppEngineTokenSource is deprecated on App Engine standard second generation runtimes (>= Go 1.11) and App Engine flexible. Please use DefaultTokenSource or ComputeTokenSource.")
|
||||||
|
})
|
||||||
|
return ComputeTokenSource("")
|
||||||
|
}
|
154
vendor/golang.org/x/oauth2/google/default.go
generated
vendored
Normal file
154
vendor/golang.org/x/oauth2/google/default.go
generated
vendored
Normal file
|
@ -0,0 +1,154 @@
|
||||||
|
// Copyright 2015 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package google
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
|
"cloud.google.com/go/compute/metadata"
|
||||||
|
"golang.org/x/oauth2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Credentials holds Google credentials, including "Application Default Credentials".
|
||||||
|
// For more details, see:
|
||||||
|
// https://developers.google.com/accounts/docs/application-default-credentials
|
||||||
|
type Credentials struct {
|
||||||
|
ProjectID string // may be empty
|
||||||
|
TokenSource oauth2.TokenSource
|
||||||
|
|
||||||
|
// JSON contains the raw bytes from a JSON credentials file.
|
||||||
|
// This field may be nil if authentication is provided by the
|
||||||
|
// environment and not with a credentials file, e.g. when code is
|
||||||
|
// running on Google Cloud Platform.
|
||||||
|
JSON []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultCredentials is the old name of Credentials.
|
||||||
|
//
|
||||||
|
// Deprecated: use Credentials instead.
|
||||||
|
type DefaultCredentials = Credentials
|
||||||
|
|
||||||
|
// DefaultClient returns an HTTP Client that uses the
|
||||||
|
// DefaultTokenSource to obtain authentication credentials.
|
||||||
|
func DefaultClient(ctx context.Context, scope ...string) (*http.Client, error) {
|
||||||
|
ts, err := DefaultTokenSource(ctx, scope...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return oauth2.NewClient(ctx, ts), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultTokenSource returns the token source for
|
||||||
|
// "Application Default Credentials".
|
||||||
|
// It is a shortcut for FindDefaultCredentials(ctx, scope).TokenSource.
|
||||||
|
func DefaultTokenSource(ctx context.Context, scope ...string) (oauth2.TokenSource, error) {
|
||||||
|
creds, err := FindDefaultCredentials(ctx, scope...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return creds.TokenSource, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindDefaultCredentials searches for "Application Default Credentials".
|
||||||
|
//
|
||||||
|
// It looks for credentials in the following places,
|
||||||
|
// preferring the first location found:
|
||||||
|
//
|
||||||
|
// 1. A JSON file whose path is specified by the
|
||||||
|
// GOOGLE_APPLICATION_CREDENTIALS environment variable.
|
||||||
|
// 2. A JSON file in a location known to the gcloud command-line tool.
|
||||||
|
// On Windows, this is %APPDATA%/gcloud/application_default_credentials.json.
|
||||||
|
// On other systems, $HOME/.config/gcloud/application_default_credentials.json.
|
||||||
|
// 3. On Google App Engine standard first generation runtimes (<= Go 1.9) it uses
|
||||||
|
// the appengine.AccessToken function.
|
||||||
|
// 4. On Google Compute Engine, Google App Engine standard second generation runtimes
|
||||||
|
// (>= Go 1.11), and Google App Engine flexible environment, it fetches
|
||||||
|
// credentials from the metadata server.
|
||||||
|
func FindDefaultCredentials(ctx context.Context, scopes ...string) (*Credentials, error) {
|
||||||
|
// First, try the environment variable.
|
||||||
|
const envVar = "GOOGLE_APPLICATION_CREDENTIALS"
|
||||||
|
if filename := os.Getenv(envVar); filename != "" {
|
||||||
|
creds, err := readCredentialsFile(ctx, filename, scopes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("google: error getting credentials using %v environment variable: %v", envVar, err)
|
||||||
|
}
|
||||||
|
return creds, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Second, try a well-known file.
|
||||||
|
filename := wellKnownFile()
|
||||||
|
if creds, err := readCredentialsFile(ctx, filename, scopes); err == nil {
|
||||||
|
return creds, nil
|
||||||
|
} else if !os.IsNotExist(err) {
|
||||||
|
return nil, fmt.Errorf("google: error getting credentials using well-known file (%v): %v", filename, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Third, if we're on a Google App Engine standard first generation runtime (<= Go 1.9)
|
||||||
|
// use those credentials. App Engine standard second generation runtimes (>= Go 1.11)
|
||||||
|
// and App Engine flexible use ComputeTokenSource and the metadata server.
|
||||||
|
if appengineTokenFunc != nil {
|
||||||
|
return &DefaultCredentials{
|
||||||
|
ProjectID: appengineAppIDFunc(ctx),
|
||||||
|
TokenSource: AppEngineTokenSource(ctx, scopes...),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fourth, if we're on Google Compute Engine, an App Engine standard second generation runtime,
|
||||||
|
// or App Engine flexible, use the metadata server.
|
||||||
|
if metadata.OnGCE() {
|
||||||
|
id, _ := metadata.ProjectID()
|
||||||
|
return &DefaultCredentials{
|
||||||
|
ProjectID: id,
|
||||||
|
TokenSource: ComputeTokenSource("", scopes...),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// None are found; return helpful error.
|
||||||
|
const url = "https://developers.google.com/accounts/docs/application-default-credentials"
|
||||||
|
return nil, fmt.Errorf("google: could not find default credentials. See %v for more information.", url)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CredentialsFromJSON obtains Google credentials from a JSON value. The JSON can
|
||||||
|
// represent either a Google Developers Console client_credentials.json file (as in
|
||||||
|
// ConfigFromJSON) or a Google Developers service account key file (as in
|
||||||
|
// JWTConfigFromJSON).
|
||||||
|
func CredentialsFromJSON(ctx context.Context, jsonData []byte, scopes ...string) (*Credentials, error) {
|
||||||
|
var f credentialsFile
|
||||||
|
if err := json.Unmarshal(jsonData, &f); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
ts, err := f.tokenSource(ctx, append([]string(nil), scopes...))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &DefaultCredentials{
|
||||||
|
ProjectID: f.ProjectID,
|
||||||
|
TokenSource: ts,
|
||||||
|
JSON: jsonData,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func wellKnownFile() string {
|
||||||
|
const f = "application_default_credentials.json"
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
return filepath.Join(os.Getenv("APPDATA"), "gcloud", f)
|
||||||
|
}
|
||||||
|
return filepath.Join(guessUnixHomeDir(), ".config", "gcloud", f)
|
||||||
|
}
|
||||||
|
|
||||||
|
func readCredentialsFile(ctx context.Context, filename string, scopes []string) (*DefaultCredentials, error) {
|
||||||
|
b, err := ioutil.ReadFile(filename)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return CredentialsFromJSON(ctx, b, scopes...)
|
||||||
|
}
|
40
vendor/golang.org/x/oauth2/google/doc.go
generated
vendored
Normal file
40
vendor/golang.org/x/oauth2/google/doc.go
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Package google provides support for making OAuth2 authorized and authenticated
|
||||||
|
// HTTP requests to Google APIs. It supports the Web server flow, client-side
|
||||||
|
// credentials, service accounts, Google Compute Engine service accounts, and Google
|
||||||
|
// App Engine service accounts.
|
||||||
|
//
|
||||||
|
// A brief overview of the package follows. For more information, please read
|
||||||
|
// https://developers.google.com/accounts/docs/OAuth2
|
||||||
|
// and
|
||||||
|
// https://developers.google.com/accounts/docs/application-default-credentials.
|
||||||
|
//
|
||||||
|
// OAuth2 Configs
|
||||||
|
//
|
||||||
|
// Two functions in this package return golang.org/x/oauth2.Config values from Google credential
|
||||||
|
// data. Google supports two JSON formats for OAuth2 credentials: one is handled by ConfigFromJSON,
|
||||||
|
// the other by JWTConfigFromJSON. The returned Config can be used to obtain a TokenSource or
|
||||||
|
// create an http.Client.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Credentials
|
||||||
|
//
|
||||||
|
// The Credentials type represents Google credentials, including Application Default
|
||||||
|
// Credentials.
|
||||||
|
//
|
||||||
|
// Use FindDefaultCredentials to obtain Application Default Credentials.
|
||||||
|
// FindDefaultCredentials looks in some well-known places for a credentials file, and
|
||||||
|
// will call AppEngineTokenSource or ComputeTokenSource as needed.
|
||||||
|
//
|
||||||
|
// DefaultClient and DefaultTokenSource are convenience methods. They first call FindDefaultCredentials,
|
||||||
|
// then use the credentials to construct an http.Client or an oauth2.TokenSource.
|
||||||
|
//
|
||||||
|
// Use CredentialsFromJSON to obtain credentials from either of the two JSON formats
|
||||||
|
// described in OAuth2 Configs, above. The TokenSource in the returned value is the
|
||||||
|
// same as the one obtained from the oauth2.Config returned from ConfigFromJSON or
|
||||||
|
// JWTConfigFromJSON, but the Credentials may contain additional information
|
||||||
|
// that is useful is some circumstances.
|
||||||
|
package google // import "golang.org/x/oauth2/google"
|
209
vendor/golang.org/x/oauth2/google/google.go
generated
vendored
Normal file
209
vendor/golang.org/x/oauth2/google/google.go
generated
vendored
Normal file
|
@ -0,0 +1,209 @@
|
||||||
|
// Copyright 2014 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package google
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"cloud.google.com/go/compute/metadata"
|
||||||
|
"golang.org/x/oauth2"
|
||||||
|
"golang.org/x/oauth2/jwt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Endpoint is Google's OAuth 2.0 endpoint.
|
||||||
|
var Endpoint = oauth2.Endpoint{
|
||||||
|
AuthURL: "https://accounts.google.com/o/oauth2/auth",
|
||||||
|
TokenURL: "https://oauth2.googleapis.com/token",
|
||||||
|
AuthStyle: oauth2.AuthStyleInParams,
|
||||||
|
}
|
||||||
|
|
||||||
|
// JWTTokenURL is Google's OAuth 2.0 token URL to use with the JWT flow.
|
||||||
|
const JWTTokenURL = "https://oauth2.googleapis.com/token"
|
||||||
|
|
||||||
|
// ConfigFromJSON uses a Google Developers Console client_credentials.json
|
||||||
|
// file to construct a config.
|
||||||
|
// client_credentials.json can be downloaded from
|
||||||
|
// https://console.developers.google.com, under "Credentials". Download the Web
|
||||||
|
// application credentials in the JSON format and provide the contents of the
|
||||||
|
// file as jsonKey.
|
||||||
|
func ConfigFromJSON(jsonKey []byte, scope ...string) (*oauth2.Config, error) {
|
||||||
|
type cred struct {
|
||||||
|
ClientID string `json:"client_id"`
|
||||||
|
ClientSecret string `json:"client_secret"`
|
||||||
|
RedirectURIs []string `json:"redirect_uris"`
|
||||||
|
AuthURI string `json:"auth_uri"`
|
||||||
|
TokenURI string `json:"token_uri"`
|
||||||
|
}
|
||||||
|
var j struct {
|
||||||
|
Web *cred `json:"web"`
|
||||||
|
Installed *cred `json:"installed"`
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal(jsonKey, &j); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var c *cred
|
||||||
|
switch {
|
||||||
|
case j.Web != nil:
|
||||||
|
c = j.Web
|
||||||
|
case j.Installed != nil:
|
||||||
|
c = j.Installed
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("oauth2/google: no credentials found")
|
||||||
|
}
|
||||||
|
if len(c.RedirectURIs) < 1 {
|
||||||
|
return nil, errors.New("oauth2/google: missing redirect URL in the client_credentials.json")
|
||||||
|
}
|
||||||
|
return &oauth2.Config{
|
||||||
|
ClientID: c.ClientID,
|
||||||
|
ClientSecret: c.ClientSecret,
|
||||||
|
RedirectURL: c.RedirectURIs[0],
|
||||||
|
Scopes: scope,
|
||||||
|
Endpoint: oauth2.Endpoint{
|
||||||
|
AuthURL: c.AuthURI,
|
||||||
|
TokenURL: c.TokenURI,
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// JWTConfigFromJSON uses a Google Developers service account JSON key file to read
|
||||||
|
// the credentials that authorize and authenticate the requests.
|
||||||
|
// Create a service account on "Credentials" for your project at
|
||||||
|
// https://console.developers.google.com to download a JSON key file.
|
||||||
|
func JWTConfigFromJSON(jsonKey []byte, scope ...string) (*jwt.Config, error) {
|
||||||
|
var f credentialsFile
|
||||||
|
if err := json.Unmarshal(jsonKey, &f); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if f.Type != serviceAccountKey {
|
||||||
|
return nil, fmt.Errorf("google: read JWT from JSON credentials: 'type' field is %q (expected %q)", f.Type, serviceAccountKey)
|
||||||
|
}
|
||||||
|
scope = append([]string(nil), scope...) // copy
|
||||||
|
return f.jwtConfig(scope), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// JSON key file types.
|
||||||
|
const (
|
||||||
|
serviceAccountKey = "service_account"
|
||||||
|
userCredentialsKey = "authorized_user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// credentialsFile is the unmarshalled representation of a credentials file.
|
||||||
|
type credentialsFile struct {
|
||||||
|
Type string `json:"type"` // serviceAccountKey or userCredentialsKey
|
||||||
|
|
||||||
|
// Service Account fields
|
||||||
|
ClientEmail string `json:"client_email"`
|
||||||
|
PrivateKeyID string `json:"private_key_id"`
|
||||||
|
PrivateKey string `json:"private_key"`
|
||||||
|
TokenURL string `json:"token_uri"`
|
||||||
|
ProjectID string `json:"project_id"`
|
||||||
|
|
||||||
|
// User Credential fields
|
||||||
|
// (These typically come from gcloud auth.)
|
||||||
|
ClientSecret string `json:"client_secret"`
|
||||||
|
ClientID string `json:"client_id"`
|
||||||
|
RefreshToken string `json:"refresh_token"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *credentialsFile) jwtConfig(scopes []string) *jwt.Config {
|
||||||
|
cfg := &jwt.Config{
|
||||||
|
Email: f.ClientEmail,
|
||||||
|
PrivateKey: []byte(f.PrivateKey),
|
||||||
|
PrivateKeyID: f.PrivateKeyID,
|
||||||
|
Scopes: scopes,
|
||||||
|
TokenURL: f.TokenURL,
|
||||||
|
}
|
||||||
|
if cfg.TokenURL == "" {
|
||||||
|
cfg.TokenURL = JWTTokenURL
|
||||||
|
}
|
||||||
|
return cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *credentialsFile) tokenSource(ctx context.Context, scopes []string) (oauth2.TokenSource, error) {
|
||||||
|
switch f.Type {
|
||||||
|
case serviceAccountKey:
|
||||||
|
cfg := f.jwtConfig(scopes)
|
||||||
|
return cfg.TokenSource(ctx), nil
|
||||||
|
case userCredentialsKey:
|
||||||
|
cfg := &oauth2.Config{
|
||||||
|
ClientID: f.ClientID,
|
||||||
|
ClientSecret: f.ClientSecret,
|
||||||
|
Scopes: scopes,
|
||||||
|
Endpoint: Endpoint,
|
||||||
|
}
|
||||||
|
tok := &oauth2.Token{RefreshToken: f.RefreshToken}
|
||||||
|
return cfg.TokenSource(ctx, tok), nil
|
||||||
|
case "":
|
||||||
|
return nil, errors.New("missing 'type' field in credentials")
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("unknown credential type: %q", f.Type)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ComputeTokenSource returns a token source that fetches access tokens
|
||||||
|
// from Google Compute Engine (GCE)'s metadata server. It's only valid to use
|
||||||
|
// this token source if your program is running on a GCE instance.
|
||||||
|
// If no account is specified, "default" is used.
|
||||||
|
// If no scopes are specified, a set of default scopes are automatically granted.
|
||||||
|
// Further information about retrieving access tokens from the GCE metadata
|
||||||
|
// server can be found at https://cloud.google.com/compute/docs/authentication.
|
||||||
|
func ComputeTokenSource(account string, scope ...string) oauth2.TokenSource {
|
||||||
|
return oauth2.ReuseTokenSource(nil, computeSource{account: account, scopes: scope})
|
||||||
|
}
|
||||||
|
|
||||||
|
type computeSource struct {
|
||||||
|
account string
|
||||||
|
scopes []string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cs computeSource) Token() (*oauth2.Token, error) {
|
||||||
|
if !metadata.OnGCE() {
|
||||||
|
return nil, errors.New("oauth2/google: can't get a token from the metadata service; not running on GCE")
|
||||||
|
}
|
||||||
|
acct := cs.account
|
||||||
|
if acct == "" {
|
||||||
|
acct = "default"
|
||||||
|
}
|
||||||
|
tokenURI := "instance/service-accounts/" + acct + "/token"
|
||||||
|
if len(cs.scopes) > 0 {
|
||||||
|
v := url.Values{}
|
||||||
|
v.Set("scopes", strings.Join(cs.scopes, ","))
|
||||||
|
tokenURI = tokenURI + "?" + v.Encode()
|
||||||
|
}
|
||||||
|
tokenJSON, err := metadata.Get(tokenURI)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var res struct {
|
||||||
|
AccessToken string `json:"access_token"`
|
||||||
|
ExpiresInSec int `json:"expires_in"`
|
||||||
|
TokenType string `json:"token_type"`
|
||||||
|
}
|
||||||
|
err = json.NewDecoder(strings.NewReader(tokenJSON)).Decode(&res)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("oauth2/google: invalid token JSON from metadata: %v", err)
|
||||||
|
}
|
||||||
|
if res.ExpiresInSec == 0 || res.AccessToken == "" {
|
||||||
|
return nil, fmt.Errorf("oauth2/google: incomplete token received from metadata")
|
||||||
|
}
|
||||||
|
tok := &oauth2.Token{
|
||||||
|
AccessToken: res.AccessToken,
|
||||||
|
TokenType: res.TokenType,
|
||||||
|
Expiry: time.Now().Add(time.Duration(res.ExpiresInSec) * time.Second),
|
||||||
|
}
|
||||||
|
// NOTE(cbro): add hidden metadata about where the token is from.
|
||||||
|
// This is needed for detection by client libraries to know that credentials come from the metadata server.
|
||||||
|
// This may be removed in a future version of this library.
|
||||||
|
return tok.WithExtra(map[string]interface{}{
|
||||||
|
"oauth2.google.tokenSource": "compute-metadata",
|
||||||
|
"oauth2.google.serviceAccount": acct,
|
||||||
|
}), nil
|
||||||
|
}
|
74
vendor/golang.org/x/oauth2/google/jwt.go
generated
vendored
Normal file
74
vendor/golang.org/x/oauth2/google/jwt.go
generated
vendored
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
// Copyright 2015 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package google
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/rsa"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/oauth2"
|
||||||
|
"golang.org/x/oauth2/internal"
|
||||||
|
"golang.org/x/oauth2/jws"
|
||||||
|
)
|
||||||
|
|
||||||
|
// JWTAccessTokenSourceFromJSON uses a Google Developers service account JSON
|
||||||
|
// key file to read the credentials that authorize and authenticate the
|
||||||
|
// requests, and returns a TokenSource that does not use any OAuth2 flow but
|
||||||
|
// instead creates a JWT and sends that as the access token.
|
||||||
|
// The audience is typically a URL that specifies the scope of the credentials.
|
||||||
|
//
|
||||||
|
// Note that this is not a standard OAuth flow, but rather an
|
||||||
|
// optimization supported by a few Google services.
|
||||||
|
// Unless you know otherwise, you should use JWTConfigFromJSON instead.
|
||||||
|
func JWTAccessTokenSourceFromJSON(jsonKey []byte, audience string) (oauth2.TokenSource, error) {
|
||||||
|
cfg, err := JWTConfigFromJSON(jsonKey)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("google: could not parse JSON key: %v", err)
|
||||||
|
}
|
||||||
|
pk, err := internal.ParseKey(cfg.PrivateKey)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("google: could not parse key: %v", err)
|
||||||
|
}
|
||||||
|
ts := &jwtAccessTokenSource{
|
||||||
|
email: cfg.Email,
|
||||||
|
audience: audience,
|
||||||
|
pk: pk,
|
||||||
|
pkID: cfg.PrivateKeyID,
|
||||||
|
}
|
||||||
|
tok, err := ts.Token()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return oauth2.ReuseTokenSource(tok, ts), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type jwtAccessTokenSource struct {
|
||||||
|
email, audience string
|
||||||
|
pk *rsa.PrivateKey
|
||||||
|
pkID string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ts *jwtAccessTokenSource) Token() (*oauth2.Token, error) {
|
||||||
|
iat := time.Now()
|
||||||
|
exp := iat.Add(time.Hour)
|
||||||
|
cs := &jws.ClaimSet{
|
||||||
|
Iss: ts.email,
|
||||||
|
Sub: ts.email,
|
||||||
|
Aud: ts.audience,
|
||||||
|
Iat: iat.Unix(),
|
||||||
|
Exp: exp.Unix(),
|
||||||
|
}
|
||||||
|
hdr := &jws.Header{
|
||||||
|
Algorithm: "RS256",
|
||||||
|
Typ: "JWT",
|
||||||
|
KeyID: string(ts.pkID),
|
||||||
|
}
|
||||||
|
msg, err := jws.Encode(hdr, cs, ts.pk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("google: could not encode JWT: %v", err)
|
||||||
|
}
|
||||||
|
return &oauth2.Token{AccessToken: msg, TokenType: "Bearer", Expiry: exp}, nil
|
||||||
|
}
|
201
vendor/golang.org/x/oauth2/google/sdk.go
generated
vendored
Normal file
201
vendor/golang.org/x/oauth2/google/sdk.go
generated
vendored
Normal file
|
@ -0,0 +1,201 @@
|
||||||
|
// Copyright 2015 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package google
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"os/user"
|
||||||
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/oauth2"
|
||||||
|
)
|
||||||
|
|
||||||
|
type sdkCredentials struct {
|
||||||
|
Data []struct {
|
||||||
|
Credential struct {
|
||||||
|
ClientID string `json:"client_id"`
|
||||||
|
ClientSecret string `json:"client_secret"`
|
||||||
|
AccessToken string `json:"access_token"`
|
||||||
|
RefreshToken string `json:"refresh_token"`
|
||||||
|
TokenExpiry *time.Time `json:"token_expiry"`
|
||||||
|
} `json:"credential"`
|
||||||
|
Key struct {
|
||||||
|
Account string `json:"account"`
|
||||||
|
Scope string `json:"scope"`
|
||||||
|
} `json:"key"`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// An SDKConfig provides access to tokens from an account already
|
||||||
|
// authorized via the Google Cloud SDK.
|
||||||
|
type SDKConfig struct {
|
||||||
|
conf oauth2.Config
|
||||||
|
initialToken *oauth2.Token
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewSDKConfig creates an SDKConfig for the given Google Cloud SDK
|
||||||
|
// account. If account is empty, the account currently active in
|
||||||
|
// Google Cloud SDK properties is used.
|
||||||
|
// Google Cloud SDK credentials must be created by running `gcloud auth`
|
||||||
|
// before using this function.
|
||||||
|
// The Google Cloud SDK is available at https://cloud.google.com/sdk/.
|
||||||
|
func NewSDKConfig(account string) (*SDKConfig, error) {
|
||||||
|
configPath, err := sdkConfigPath()
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("oauth2/google: error getting SDK config path: %v", err)
|
||||||
|
}
|
||||||
|
credentialsPath := filepath.Join(configPath, "credentials")
|
||||||
|
f, err := os.Open(credentialsPath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("oauth2/google: failed to load SDK credentials: %v", err)
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
|
var c sdkCredentials
|
||||||
|
if err := json.NewDecoder(f).Decode(&c); err != nil {
|
||||||
|
return nil, fmt.Errorf("oauth2/google: failed to decode SDK credentials from %q: %v", credentialsPath, err)
|
||||||
|
}
|
||||||
|
if len(c.Data) == 0 {
|
||||||
|
return nil, fmt.Errorf("oauth2/google: no credentials found in %q, run `gcloud auth login` to create one", credentialsPath)
|
||||||
|
}
|
||||||
|
if account == "" {
|
||||||
|
propertiesPath := filepath.Join(configPath, "properties")
|
||||||
|
f, err := os.Open(propertiesPath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("oauth2/google: failed to load SDK properties: %v", err)
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
ini, err := parseINI(f)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("oauth2/google: failed to parse SDK properties %q: %v", propertiesPath, err)
|
||||||
|
}
|
||||||
|
core, ok := ini["core"]
|
||||||
|
if !ok {
|
||||||
|
return nil, fmt.Errorf("oauth2/google: failed to find [core] section in %v", ini)
|
||||||
|
}
|
||||||
|
active, ok := core["account"]
|
||||||
|
if !ok {
|
||||||
|
return nil, fmt.Errorf("oauth2/google: failed to find %q attribute in %v", "account", core)
|
||||||
|
}
|
||||||
|
account = active
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, d := range c.Data {
|
||||||
|
if account == "" || d.Key.Account == account {
|
||||||
|
if d.Credential.AccessToken == "" && d.Credential.RefreshToken == "" {
|
||||||
|
return nil, fmt.Errorf("oauth2/google: no token available for account %q", account)
|
||||||
|
}
|
||||||
|
var expiry time.Time
|
||||||
|
if d.Credential.TokenExpiry != nil {
|
||||||
|
expiry = *d.Credential.TokenExpiry
|
||||||
|
}
|
||||||
|
return &SDKConfig{
|
||||||
|
conf: oauth2.Config{
|
||||||
|
ClientID: d.Credential.ClientID,
|
||||||
|
ClientSecret: d.Credential.ClientSecret,
|
||||||
|
Scopes: strings.Split(d.Key.Scope, " "),
|
||||||
|
Endpoint: Endpoint,
|
||||||
|
RedirectURL: "oob",
|
||||||
|
},
|
||||||
|
initialToken: &oauth2.Token{
|
||||||
|
AccessToken: d.Credential.AccessToken,
|
||||||
|
RefreshToken: d.Credential.RefreshToken,
|
||||||
|
Expiry: expiry,
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("oauth2/google: no such credentials for account %q", account)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Client returns an HTTP client using Google Cloud SDK credentials to
|
||||||
|
// authorize requests. The token will auto-refresh as necessary. The
|
||||||
|
// underlying http.RoundTripper will be obtained using the provided
|
||||||
|
// context. The returned client and its Transport should not be
|
||||||
|
// modified.
|
||||||
|
func (c *SDKConfig) Client(ctx context.Context) *http.Client {
|
||||||
|
return &http.Client{
|
||||||
|
Transport: &oauth2.Transport{
|
||||||
|
Source: c.TokenSource(ctx),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TokenSource returns an oauth2.TokenSource that retrieve tokens from
|
||||||
|
// Google Cloud SDK credentials using the provided context.
|
||||||
|
// It will returns the current access token stored in the credentials,
|
||||||
|
// and refresh it when it expires, but it won't update the credentials
|
||||||
|
// with the new access token.
|
||||||
|
func (c *SDKConfig) TokenSource(ctx context.Context) oauth2.TokenSource {
|
||||||
|
return c.conf.TokenSource(ctx, c.initialToken)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scopes are the OAuth 2.0 scopes the current account is authorized for.
|
||||||
|
func (c *SDKConfig) Scopes() []string {
|
||||||
|
return c.conf.Scopes
|
||||||
|
}
|
||||||
|
|
||||||
|
func parseINI(ini io.Reader) (map[string]map[string]string, error) {
|
||||||
|
result := map[string]map[string]string{
|
||||||
|
"": {}, // root section
|
||||||
|
}
|
||||||
|
scanner := bufio.NewScanner(ini)
|
||||||
|
currentSection := ""
|
||||||
|
for scanner.Scan() {
|
||||||
|
line := strings.TrimSpace(scanner.Text())
|
||||||
|
if strings.HasPrefix(line, ";") {
|
||||||
|
// comment.
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(line, "[") && strings.HasSuffix(line, "]") {
|
||||||
|
currentSection = strings.TrimSpace(line[1 : len(line)-1])
|
||||||
|
result[currentSection] = map[string]string{}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
parts := strings.SplitN(line, "=", 2)
|
||||||
|
if len(parts) == 2 && parts[0] != "" {
|
||||||
|
result[currentSection][strings.TrimSpace(parts[0])] = strings.TrimSpace(parts[1])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := scanner.Err(); err != nil {
|
||||||
|
return nil, fmt.Errorf("error scanning ini: %v", err)
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// sdkConfigPath tries to guess where the gcloud config is located.
|
||||||
|
// It can be overridden during tests.
|
||||||
|
var sdkConfigPath = func() (string, error) {
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
return filepath.Join(os.Getenv("APPDATA"), "gcloud"), nil
|
||||||
|
}
|
||||||
|
homeDir := guessUnixHomeDir()
|
||||||
|
if homeDir == "" {
|
||||||
|
return "", errors.New("unable to get current user home directory: os/user lookup failed; $HOME is empty")
|
||||||
|
}
|
||||||
|
return filepath.Join(homeDir, ".config", "gcloud"), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func guessUnixHomeDir() string {
|
||||||
|
// Prefer $HOME over user.Current due to glibc bug: golang.org/issue/13470
|
||||||
|
if v := os.Getenv("HOME"); v != "" {
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
// Else, fall back to user.Current:
|
||||||
|
if u, err := user.Current(); err == nil {
|
||||||
|
return u.HomeDir
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
182
vendor/golang.org/x/oauth2/jws/jws.go
generated
vendored
Normal file
182
vendor/golang.org/x/oauth2/jws/jws.go
generated
vendored
Normal file
|
@ -0,0 +1,182 @@
|
||||||
|
// Copyright 2014 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Package jws provides a partial implementation
|
||||||
|
// of JSON Web Signature encoding and decoding.
|
||||||
|
// It exists to support the golang.org/x/oauth2 package.
|
||||||
|
//
|
||||||
|
// See RFC 7515.
|
||||||
|
//
|
||||||
|
// Deprecated: this package is not intended for public use and might be
|
||||||
|
// removed in the future. It exists for internal use only.
|
||||||
|
// Please switch to another JWS package or copy this package into your own
|
||||||
|
// source tree.
|
||||||
|
package jws // import "golang.org/x/oauth2/jws"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"crypto"
|
||||||
|
"crypto/rand"
|
||||||
|
"crypto/rsa"
|
||||||
|
"crypto/sha256"
|
||||||
|
"encoding/base64"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ClaimSet contains information about the JWT signature including the
|
||||||
|
// permissions being requested (scopes), the target of the token, the issuer,
|
||||||
|
// the time the token was issued, and the lifetime of the token.
|
||||||
|
type ClaimSet struct {
|
||||||
|
Iss string `json:"iss"` // email address of the client_id of the application making the access token request
|
||||||
|
Scope string `json:"scope,omitempty"` // space-delimited list of the permissions the application requests
|
||||||
|
Aud string `json:"aud"` // descriptor of the intended target of the assertion (Optional).
|
||||||
|
Exp int64 `json:"exp"` // the expiration time of the assertion (seconds since Unix epoch)
|
||||||
|
Iat int64 `json:"iat"` // the time the assertion was issued (seconds since Unix epoch)
|
||||||
|
Typ string `json:"typ,omitempty"` // token type (Optional).
|
||||||
|
|
||||||
|
// Email for which the application is requesting delegated access (Optional).
|
||||||
|
Sub string `json:"sub,omitempty"`
|
||||||
|
|
||||||
|
// The old name of Sub. Client keeps setting Prn to be
|
||||||
|
// complaint with legacy OAuth 2.0 providers. (Optional)
|
||||||
|
Prn string `json:"prn,omitempty"`
|
||||||
|
|
||||||
|
// See http://tools.ietf.org/html/draft-jones-json-web-token-10#section-4.3
|
||||||
|
// This array is marshalled using custom code (see (c *ClaimSet) encode()).
|
||||||
|
PrivateClaims map[string]interface{} `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ClaimSet) encode() (string, error) {
|
||||||
|
// Reverting time back for machines whose time is not perfectly in sync.
|
||||||
|
// If client machine's time is in the future according
|
||||||
|
// to Google servers, an access token will not be issued.
|
||||||
|
now := time.Now().Add(-10 * time.Second)
|
||||||
|
if c.Iat == 0 {
|
||||||
|
c.Iat = now.Unix()
|
||||||
|
}
|
||||||
|
if c.Exp == 0 {
|
||||||
|
c.Exp = now.Add(time.Hour).Unix()
|
||||||
|
}
|
||||||
|
if c.Exp < c.Iat {
|
||||||
|
return "", fmt.Errorf("jws: invalid Exp = %v; must be later than Iat = %v", c.Exp, c.Iat)
|
||||||
|
}
|
||||||
|
|
||||||
|
b, err := json.Marshal(c)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(c.PrivateClaims) == 0 {
|
||||||
|
return base64.RawURLEncoding.EncodeToString(b), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Marshal private claim set and then append it to b.
|
||||||
|
prv, err := json.Marshal(c.PrivateClaims)
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("jws: invalid map of private claims %v", c.PrivateClaims)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Concatenate public and private claim JSON objects.
|
||||||
|
if !bytes.HasSuffix(b, []byte{'}'}) {
|
||||||
|
return "", fmt.Errorf("jws: invalid JSON %s", b)
|
||||||
|
}
|
||||||
|
if !bytes.HasPrefix(prv, []byte{'{'}) {
|
||||||
|
return "", fmt.Errorf("jws: invalid JSON %s", prv)
|
||||||
|
}
|
||||||
|
b[len(b)-1] = ',' // Replace closing curly brace with a comma.
|
||||||
|
b = append(b, prv[1:]...) // Append private claims.
|
||||||
|
return base64.RawURLEncoding.EncodeToString(b), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Header represents the header for the signed JWS payloads.
|
||||||
|
type Header struct {
|
||||||
|
// The algorithm used for signature.
|
||||||
|
Algorithm string `json:"alg"`
|
||||||
|
|
||||||
|
// Represents the token type.
|
||||||
|
Typ string `json:"typ"`
|
||||||
|
|
||||||
|
// The optional hint of which key is being used.
|
||||||
|
KeyID string `json:"kid,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *Header) encode() (string, error) {
|
||||||
|
b, err := json.Marshal(h)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return base64.RawURLEncoding.EncodeToString(b), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decode decodes a claim set from a JWS payload.
|
||||||
|
func Decode(payload string) (*ClaimSet, error) {
|
||||||
|
// decode returned id token to get expiry
|
||||||
|
s := strings.Split(payload, ".")
|
||||||
|
if len(s) < 2 {
|
||||||
|
// TODO(jbd): Provide more context about the error.
|
||||||
|
return nil, errors.New("jws: invalid token received")
|
||||||
|
}
|
||||||
|
decoded, err := base64.RawURLEncoding.DecodeString(s[1])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
c := &ClaimSet{}
|
||||||
|
err = json.NewDecoder(bytes.NewBuffer(decoded)).Decode(c)
|
||||||
|
return c, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Signer returns a signature for the given data.
|
||||||
|
type Signer func(data []byte) (sig []byte, err error)
|
||||||
|
|
||||||
|
// EncodeWithSigner encodes a header and claim set with the provided signer.
|
||||||
|
func EncodeWithSigner(header *Header, c *ClaimSet, sg Signer) (string, error) {
|
||||||
|
head, err := header.encode()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
cs, err := c.encode()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
ss := fmt.Sprintf("%s.%s", head, cs)
|
||||||
|
sig, err := sg([]byte(ss))
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("%s.%s", ss, base64.RawURLEncoding.EncodeToString(sig)), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Encode encodes a signed JWS with provided header and claim set.
|
||||||
|
// This invokes EncodeWithSigner using crypto/rsa.SignPKCS1v15 with the given RSA private key.
|
||||||
|
func Encode(header *Header, c *ClaimSet, key *rsa.PrivateKey) (string, error) {
|
||||||
|
sg := func(data []byte) (sig []byte, err error) {
|
||||||
|
h := sha256.New()
|
||||||
|
h.Write(data)
|
||||||
|
return rsa.SignPKCS1v15(rand.Reader, key, crypto.SHA256, h.Sum(nil))
|
||||||
|
}
|
||||||
|
return EncodeWithSigner(header, c, sg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify tests whether the provided JWT token's signature was produced by the private key
|
||||||
|
// associated with the supplied public key.
|
||||||
|
func Verify(token string, key *rsa.PublicKey) error {
|
||||||
|
parts := strings.Split(token, ".")
|
||||||
|
if len(parts) != 3 {
|
||||||
|
return errors.New("jws: invalid token received, token must have 3 parts")
|
||||||
|
}
|
||||||
|
|
||||||
|
signedContent := parts[0] + "." + parts[1]
|
||||||
|
signatureString, err := base64.RawURLEncoding.DecodeString(parts[2])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
h := sha256.New()
|
||||||
|
h.Write([]byte(signedContent))
|
||||||
|
return rsa.VerifyPKCS1v15(key, crypto.SHA256, h.Sum(nil), []byte(signatureString))
|
||||||
|
}
|
185
vendor/golang.org/x/oauth2/jwt/jwt.go
generated
vendored
Normal file
185
vendor/golang.org/x/oauth2/jwt/jwt.go
generated
vendored
Normal file
|
@ -0,0 +1,185 @@
|
||||||
|
// Copyright 2014 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Package jwt implements the OAuth 2.0 JSON Web Token flow, commonly
|
||||||
|
// known as "two-legged OAuth 2.0".
|
||||||
|
//
|
||||||
|
// See: https://tools.ietf.org/html/draft-ietf-oauth-jwt-bearer-12
|
||||||
|
package jwt
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/oauth2"
|
||||||
|
"golang.org/x/oauth2/internal"
|
||||||
|
"golang.org/x/oauth2/jws"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
defaultGrantType = "urn:ietf:params:oauth:grant-type:jwt-bearer"
|
||||||
|
defaultHeader = &jws.Header{Algorithm: "RS256", Typ: "JWT"}
|
||||||
|
)
|
||||||
|
|
||||||
|
// Config is the configuration for using JWT to fetch tokens,
|
||||||
|
// commonly known as "two-legged OAuth 2.0".
|
||||||
|
type Config struct {
|
||||||
|
// Email is the OAuth client identifier used when communicating with
|
||||||
|
// the configured OAuth provider.
|
||||||
|
Email string
|
||||||
|
|
||||||
|
// PrivateKey contains the contents of an RSA private key or the
|
||||||
|
// contents of a PEM file that contains a private key. The provided
|
||||||
|
// private key is used to sign JWT payloads.
|
||||||
|
// PEM containers with a passphrase are not supported.
|
||||||
|
// Use the following command to convert a PKCS 12 file into a PEM.
|
||||||
|
//
|
||||||
|
// $ openssl pkcs12 -in key.p12 -out key.pem -nodes
|
||||||
|
//
|
||||||
|
PrivateKey []byte
|
||||||
|
|
||||||
|
// PrivateKeyID contains an optional hint indicating which key is being
|
||||||
|
// used.
|
||||||
|
PrivateKeyID string
|
||||||
|
|
||||||
|
// Subject is the optional user to impersonate.
|
||||||
|
Subject string
|
||||||
|
|
||||||
|
// Scopes optionally specifies a list of requested permission scopes.
|
||||||
|
Scopes []string
|
||||||
|
|
||||||
|
// TokenURL is the endpoint required to complete the 2-legged JWT flow.
|
||||||
|
TokenURL string
|
||||||
|
|
||||||
|
// Expires optionally specifies how long the token is valid for.
|
||||||
|
Expires time.Duration
|
||||||
|
|
||||||
|
// Audience optionally specifies the intended audience of the
|
||||||
|
// request. If empty, the value of TokenURL is used as the
|
||||||
|
// intended audience.
|
||||||
|
Audience string
|
||||||
|
|
||||||
|
// PrivateClaims optionally specifies custom private claims in the JWT.
|
||||||
|
// See http://tools.ietf.org/html/draft-jones-json-web-token-10#section-4.3
|
||||||
|
PrivateClaims map[string]interface{}
|
||||||
|
|
||||||
|
// UseIDToken optionally specifies whether ID token should be used instead
|
||||||
|
// of access token when the server returns both.
|
||||||
|
UseIDToken bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// TokenSource returns a JWT TokenSource using the configuration
|
||||||
|
// in c and the HTTP client from the provided context.
|
||||||
|
func (c *Config) TokenSource(ctx context.Context) oauth2.TokenSource {
|
||||||
|
return oauth2.ReuseTokenSource(nil, jwtSource{ctx, c})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Client returns an HTTP client wrapping the context's
|
||||||
|
// HTTP transport and adding Authorization headers with tokens
|
||||||
|
// obtained from c.
|
||||||
|
//
|
||||||
|
// The returned client and its Transport should not be modified.
|
||||||
|
func (c *Config) Client(ctx context.Context) *http.Client {
|
||||||
|
return oauth2.NewClient(ctx, c.TokenSource(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// jwtSource is a source that always does a signed JWT request for a token.
|
||||||
|
// It should typically be wrapped with a reuseTokenSource.
|
||||||
|
type jwtSource struct {
|
||||||
|
ctx context.Context
|
||||||
|
conf *Config
|
||||||
|
}
|
||||||
|
|
||||||
|
func (js jwtSource) Token() (*oauth2.Token, error) {
|
||||||
|
pk, err := internal.ParseKey(js.conf.PrivateKey)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
hc := oauth2.NewClient(js.ctx, nil)
|
||||||
|
claimSet := &jws.ClaimSet{
|
||||||
|
Iss: js.conf.Email,
|
||||||
|
Scope: strings.Join(js.conf.Scopes, " "),
|
||||||
|
Aud: js.conf.TokenURL,
|
||||||
|
PrivateClaims: js.conf.PrivateClaims,
|
||||||
|
}
|
||||||
|
if subject := js.conf.Subject; subject != "" {
|
||||||
|
claimSet.Sub = subject
|
||||||
|
// prn is the old name of sub. Keep setting it
|
||||||
|
// to be compatible with legacy OAuth 2.0 providers.
|
||||||
|
claimSet.Prn = subject
|
||||||
|
}
|
||||||
|
if t := js.conf.Expires; t > 0 {
|
||||||
|
claimSet.Exp = time.Now().Add(t).Unix()
|
||||||
|
}
|
||||||
|
if aud := js.conf.Audience; aud != "" {
|
||||||
|
claimSet.Aud = aud
|
||||||
|
}
|
||||||
|
h := *defaultHeader
|
||||||
|
h.KeyID = js.conf.PrivateKeyID
|
||||||
|
payload, err := jws.Encode(&h, claimSet, pk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
v := url.Values{}
|
||||||
|
v.Set("grant_type", defaultGrantType)
|
||||||
|
v.Set("assertion", payload)
|
||||||
|
resp, err := hc.PostForm(js.conf.TokenURL, v)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("oauth2: cannot fetch token: %v", err)
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
body, err := ioutil.ReadAll(io.LimitReader(resp.Body, 1<<20))
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("oauth2: cannot fetch token: %v", err)
|
||||||
|
}
|
||||||
|
if c := resp.StatusCode; c < 200 || c > 299 {
|
||||||
|
return nil, &oauth2.RetrieveError{
|
||||||
|
Response: resp,
|
||||||
|
Body: body,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// tokenRes is the JSON response body.
|
||||||
|
var tokenRes struct {
|
||||||
|
AccessToken string `json:"access_token"`
|
||||||
|
TokenType string `json:"token_type"`
|
||||||
|
IDToken string `json:"id_token"`
|
||||||
|
ExpiresIn int64 `json:"expires_in"` // relative seconds from now
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal(body, &tokenRes); err != nil {
|
||||||
|
return nil, fmt.Errorf("oauth2: cannot fetch token: %v", err)
|
||||||
|
}
|
||||||
|
token := &oauth2.Token{
|
||||||
|
AccessToken: tokenRes.AccessToken,
|
||||||
|
TokenType: tokenRes.TokenType,
|
||||||
|
}
|
||||||
|
raw := make(map[string]interface{})
|
||||||
|
json.Unmarshal(body, &raw) // no error checks for optional fields
|
||||||
|
token = token.WithExtra(raw)
|
||||||
|
|
||||||
|
if secs := tokenRes.ExpiresIn; secs > 0 {
|
||||||
|
token.Expiry = time.Now().Add(time.Duration(secs) * time.Second)
|
||||||
|
}
|
||||||
|
if v := tokenRes.IDToken; v != "" {
|
||||||
|
// decode returned id token to get expiry
|
||||||
|
claimSet, err := jws.Decode(v)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("oauth2: error decoding JWT token: %v", err)
|
||||||
|
}
|
||||||
|
token.Expiry = time.Unix(claimSet.Exp, 0)
|
||||||
|
}
|
||||||
|
if js.conf.UseIDToken {
|
||||||
|
if tokenRes.IDToken == "" {
|
||||||
|
return nil, fmt.Errorf("oauth2: response doesn't have JWT token")
|
||||||
|
}
|
||||||
|
token.AccessToken = tokenRes.IDToken
|
||||||
|
}
|
||||||
|
return token, nil
|
||||||
|
}
|
20
vendor/google.golang.org/appengine/.travis.yml
generated
vendored
Normal file
20
vendor/google.golang.org/appengine/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
language: go
|
||||||
|
|
||||||
|
go_import_path: google.golang.org/appengine
|
||||||
|
|
||||||
|
install:
|
||||||
|
- ./travis_install.sh
|
||||||
|
|
||||||
|
script:
|
||||||
|
- ./travis_test.sh
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- go: 1.8.x
|
||||||
|
env: GOAPP=true
|
||||||
|
- go: 1.9.x
|
||||||
|
env: GOAPP=true
|
||||||
|
- go: 1.10.x
|
||||||
|
env: GOAPP=false
|
||||||
|
- go: 1.11.x
|
||||||
|
env: GO111MODULE=on
|
90
vendor/google.golang.org/appengine/CONTRIBUTING.md
generated
vendored
Normal file
90
vendor/google.golang.org/appengine/CONTRIBUTING.md
generated
vendored
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
# Contributing
|
||||||
|
|
||||||
|
1. Sign one of the contributor license agreements below.
|
||||||
|
1. Get the package:
|
||||||
|
|
||||||
|
`go get -d google.golang.org/appengine`
|
||||||
|
1. Change into the checked out source:
|
||||||
|
|
||||||
|
`cd $GOPATH/src/google.golang.org/appengine`
|
||||||
|
1. Fork the repo.
|
||||||
|
1. Set your fork as a remote:
|
||||||
|
|
||||||
|
`git remote add fork git@github.com:GITHUB_USERNAME/appengine.git`
|
||||||
|
1. Make changes, commit to your fork.
|
||||||
|
1. Send a pull request with your changes.
|
||||||
|
The first line of your commit message is conventionally a one-line summary of the change, prefixed by the primary affected package, and is used as the title of your pull request.
|
||||||
|
|
||||||
|
# Testing
|
||||||
|
|
||||||
|
## Running system tests
|
||||||
|
|
||||||
|
Download and install the [Go App Engine SDK](https://cloud.google.com/appengine/docs/go/download). Make sure the `go_appengine` dir is in your `PATH`.
|
||||||
|
|
||||||
|
Set the `APPENGINE_DEV_APPSERVER` environment variable to `/path/to/go_appengine/dev_appserver.py`.
|
||||||
|
|
||||||
|
Run tests with `goapp test`:
|
||||||
|
|
||||||
|
```
|
||||||
|
goapp test -v google.golang.org/appengine/...
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributor License Agreements
|
||||||
|
|
||||||
|
Before we can accept your pull requests you'll need to sign a Contributor
|
||||||
|
License Agreement (CLA):
|
||||||
|
|
||||||
|
- **If you are an individual writing original source code** and **you own the
|
||||||
|
intellectual property**, then you'll need to sign an [individual CLA][indvcla].
|
||||||
|
- **If you work for a company that wants to allow you to contribute your work**,
|
||||||
|
then you'll need to sign a [corporate CLA][corpcla].
|
||||||
|
|
||||||
|
You can sign these electronically (just scroll to the bottom). After that,
|
||||||
|
we'll be able to accept your pull requests.
|
||||||
|
|
||||||
|
## Contributor Code of Conduct
|
||||||
|
|
||||||
|
As contributors and maintainers of this project,
|
||||||
|
and in the interest of fostering an open and welcoming community,
|
||||||
|
we pledge to respect all people who contribute through reporting issues,
|
||||||
|
posting feature requests, updating documentation,
|
||||||
|
submitting pull requests or patches, and other activities.
|
||||||
|
|
||||||
|
We are committed to making participation in this project
|
||||||
|
a harassment-free experience for everyone,
|
||||||
|
regardless of level of experience, gender, gender identity and expression,
|
||||||
|
sexual orientation, disability, personal appearance,
|
||||||
|
body size, race, ethnicity, age, religion, or nationality.
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery
|
||||||
|
* Personal attacks
|
||||||
|
* Trolling or insulting/derogatory comments
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing other's private information,
|
||||||
|
such as physical or electronic
|
||||||
|
addresses, without explicit permission
|
||||||
|
* Other unethical or unprofessional conduct.
|
||||||
|
|
||||||
|
Project maintainers have the right and responsibility to remove, edit, or reject
|
||||||
|
comments, commits, code, wiki edits, issues, and other contributions
|
||||||
|
that are not aligned to this Code of Conduct.
|
||||||
|
By adopting this Code of Conduct,
|
||||||
|
project maintainers commit themselves to fairly and consistently
|
||||||
|
applying these principles to every aspect of managing this project.
|
||||||
|
Project maintainers who do not follow or enforce the Code of Conduct
|
||||||
|
may be permanently removed from the project team.
|
||||||
|
|
||||||
|
This code of conduct applies both within project spaces and in public spaces
|
||||||
|
when an individual is representing the project or its community.
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior
|
||||||
|
may be reported by opening an issue
|
||||||
|
or contacting one or more of the project maintainers.
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0,
|
||||||
|
available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
|
||||||
|
|
||||||
|
[indvcla]: https://developers.google.com/open-source/cla/individual
|
||||||
|
[corpcla]: https://developers.google.com/open-source/cla/corporate
|
100
vendor/google.golang.org/appengine/README.md
generated
vendored
Normal file
100
vendor/google.golang.org/appengine/README.md
generated
vendored
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
# Go App Engine packages
|
||||||
|
|
||||||
|
[![Build Status](https://travis-ci.org/golang/appengine.svg)](https://travis-ci.org/golang/appengine)
|
||||||
|
|
||||||
|
This repository supports the Go runtime on *App Engine standard*.
|
||||||
|
It provides APIs for interacting with App Engine services.
|
||||||
|
Its canonical import path is `google.golang.org/appengine`.
|
||||||
|
|
||||||
|
See https://cloud.google.com/appengine/docs/go/
|
||||||
|
for more information.
|
||||||
|
|
||||||
|
File issue reports and feature requests on the [GitHub's issue
|
||||||
|
tracker](https://github.com/golang/appengine/issues).
|
||||||
|
|
||||||
|
## Upgrading an App Engine app to the flexible environment
|
||||||
|
|
||||||
|
This package does not work on *App Engine flexible*.
|
||||||
|
|
||||||
|
There are many differences between the App Engine standard environment and
|
||||||
|
the flexible environment.
|
||||||
|
|
||||||
|
See the [documentation on upgrading to the flexible environment](https://cloud.google.com/appengine/docs/flexible/go/upgrading).
|
||||||
|
|
||||||
|
## Directory structure
|
||||||
|
|
||||||
|
The top level directory of this repository is the `appengine` package. It
|
||||||
|
contains the
|
||||||
|
basic APIs (e.g. `appengine.NewContext`) that apply across APIs. Specific API
|
||||||
|
packages are in subdirectories (e.g. `datastore`).
|
||||||
|
|
||||||
|
There is an `internal` subdirectory that contains service protocol buffers,
|
||||||
|
plus packages required for connectivity to make API calls. App Engine apps
|
||||||
|
should not directly import any package under `internal`.
|
||||||
|
|
||||||
|
## Updating from legacy (`import "appengine"`) packages
|
||||||
|
|
||||||
|
If you're currently using the bare `appengine` packages
|
||||||
|
(that is, not these ones, imported via `google.golang.org/appengine`),
|
||||||
|
then you can use the `aefix` tool to help automate an upgrade to these packages.
|
||||||
|
|
||||||
|
Run `go get google.golang.org/appengine/cmd/aefix` to install it.
|
||||||
|
|
||||||
|
### 1. Update import paths
|
||||||
|
|
||||||
|
The import paths for App Engine packages are now fully qualified, based at `google.golang.org/appengine`.
|
||||||
|
You will need to update your code to use import paths starting with that; for instance,
|
||||||
|
code importing `appengine/datastore` will now need to import `google.golang.org/appengine/datastore`.
|
||||||
|
|
||||||
|
### 2. Update code using deprecated, removed or modified APIs
|
||||||
|
|
||||||
|
Most App Engine services are available with exactly the same API.
|
||||||
|
A few APIs were cleaned up, and there are some differences:
|
||||||
|
|
||||||
|
* `appengine.Context` has been replaced with the `Context` type from `golang.org/x/net/context`.
|
||||||
|
* Logging methods that were on `appengine.Context` are now functions in `google.golang.org/appengine/log`.
|
||||||
|
* `appengine.Timeout` has been removed. Use `context.WithTimeout` instead.
|
||||||
|
* `appengine.Datacenter` now takes a `context.Context` argument.
|
||||||
|
* `datastore.PropertyLoadSaver` has been simplified to use slices in place of channels.
|
||||||
|
* `delay.Call` now returns an error.
|
||||||
|
* `search.FieldLoadSaver` now handles document metadata.
|
||||||
|
* `urlfetch.Transport` no longer has a Deadline field; set a deadline on the
|
||||||
|
`context.Context` instead.
|
||||||
|
* `aetest` no longer declares its own Context type, and uses the standard one instead.
|
||||||
|
* `taskqueue.QueueStats` no longer takes a maxTasks argument. That argument has been
|
||||||
|
deprecated and unused for a long time.
|
||||||
|
* `appengine.BackendHostname` and `appengine.BackendInstance` were for the deprecated backends feature.
|
||||||
|
Use `appengine.ModuleHostname`and `appengine.ModuleName` instead.
|
||||||
|
* Most of `appengine/file` and parts of `appengine/blobstore` are deprecated.
|
||||||
|
Use [Google Cloud Storage](https://godoc.org/cloud.google.com/go/storage) if the
|
||||||
|
feature you require is not present in the new
|
||||||
|
[blobstore package](https://google.golang.org/appengine/blobstore).
|
||||||
|
* `appengine/socket` is not required on App Engine flexible environment / Managed VMs.
|
||||||
|
Use the standard `net` package instead.
|
||||||
|
|
||||||
|
## Key Encode/Decode compatibiltiy to help with datastore library migrations
|
||||||
|
|
||||||
|
Key compatibility updates have been added to help customers transition from google.golang.org/appengine/datastore to cloud.google.com/go/datastore.
|
||||||
|
The `EnableKeyConversion` enables automatic conversion from a key encoded with cloud.google.com/go/datastore to google.golang.org/appengine/datastore key type.
|
||||||
|
|
||||||
|
### Enabling key conversion
|
||||||
|
|
||||||
|
Enable key conversion by calling `EnableKeyConversion(ctx)` in the `/_ah/start` handler for basic and manual scaling or any handler in automatic scaling.
|
||||||
|
|
||||||
|
#### 1. Basic or manual scaling
|
||||||
|
|
||||||
|
This start handler will enable key conversion for all handlers in the service.
|
||||||
|
|
||||||
|
```
|
||||||
|
http.HandleFunc("/_ah/start", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
datastore.EnableKeyConversion(appengine.NewContext(r))
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2. Automatic scaling
|
||||||
|
|
||||||
|
`/_ah/start` is not supported for automatic scaling and `/_ah/warmup` is not guaranteed to run, so you must call `datastore.EnableKeyConversion(appengine.NewContext(r))`
|
||||||
|
before you use code that needs key conversion.
|
||||||
|
|
||||||
|
You may want to add this to each of your handlers, or introduce middleware where it's called.
|
||||||
|
`EnableKeyConversion` is safe for concurrent use. Any call to it after the first is ignored.
|
135
vendor/google.golang.org/appengine/appengine.go
generated
vendored
Normal file
135
vendor/google.golang.org/appengine/appengine.go
generated
vendored
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
// Copyright 2011 Google Inc. All rights reserved.
|
||||||
|
// Use of this source code is governed by the Apache 2.0
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Package appengine provides basic functionality for Google App Engine.
|
||||||
|
//
|
||||||
|
// For more information on how to write Go apps for Google App Engine, see:
|
||||||
|
// https://cloud.google.com/appengine/docs/go/
|
||||||
|
package appengine // import "google.golang.org/appengine"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
|
"google.golang.org/appengine/internal"
|
||||||
|
)
|
||||||
|
|
||||||
|
// The gophers party all night; the rabbits provide the beats.
|
||||||
|
|
||||||
|
// Main is the principal entry point for an app running in App Engine.
|
||||||
|
//
|
||||||
|
// On App Engine Flexible it installs a trivial health checker if one isn't
|
||||||
|
// already registered, and starts listening on port 8080 (overridden by the
|
||||||
|
// $PORT environment variable).
|
||||||
|
//
|
||||||
|
// See https://cloud.google.com/appengine/docs/flexible/custom-runtimes#health_check_requests
|
||||||
|
// for details on how to do your own health checking.
|
||||||
|
//
|
||||||
|
// On App Engine Standard it ensures the server has started and is prepared to
|
||||||
|
// receive requests.
|
||||||
|
//
|
||||||
|
// Main never returns.
|
||||||
|
//
|
||||||
|
// Main is designed so that the app's main package looks like this:
|
||||||
|
//
|
||||||
|
// package main
|
||||||
|
//
|
||||||
|
// import (
|
||||||
|
// "google.golang.org/appengine"
|
||||||
|
//
|
||||||
|
// _ "myapp/package0"
|
||||||
|
// _ "myapp/package1"
|
||||||
|
// )
|
||||||
|
//
|
||||||
|
// func main() {
|
||||||
|
// appengine.Main()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// The "myapp/packageX" packages are expected to register HTTP handlers
|
||||||
|
// in their init functions.
|
||||||
|
func Main() {
|
||||||
|
internal.Main()
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsDevAppServer reports whether the App Engine app is running in the
|
||||||
|
// development App Server.
|
||||||
|
func IsDevAppServer() bool {
|
||||||
|
return internal.IsDevAppServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsStandard reports whether the App Engine app is running in the standard
|
||||||
|
// environment. This includes both the first generation runtimes (<= Go 1.9)
|
||||||
|
// and the second generation runtimes (>= Go 1.11).
|
||||||
|
func IsStandard() bool {
|
||||||
|
return internal.IsStandard()
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsFlex reports whether the App Engine app is running in the flexible environment.
|
||||||
|
func IsFlex() bool {
|
||||||
|
return internal.IsFlex()
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsAppEngine reports whether the App Engine app is running on App Engine, in either
|
||||||
|
// the standard or flexible environment.
|
||||||
|
func IsAppEngine() bool {
|
||||||
|
return internal.IsAppEngine()
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSecondGen reports whether the App Engine app is running on the second generation
|
||||||
|
// runtimes (>= Go 1.11).
|
||||||
|
func IsSecondGen() bool {
|
||||||
|
return internal.IsSecondGen()
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewContext returns a context for an in-flight HTTP request.
|
||||||
|
// This function is cheap.
|
||||||
|
func NewContext(req *http.Request) context.Context {
|
||||||
|
return internal.ReqContext(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext returns a copy of the parent context
|
||||||
|
// and associates it with an in-flight HTTP request.
|
||||||
|
// This function is cheap.
|
||||||
|
func WithContext(parent context.Context, req *http.Request) context.Context {
|
||||||
|
return internal.WithContext(parent, req)
|
||||||
|
}
|
||||||
|
|
||||||
|
// BlobKey is a key for a blobstore blob.
|
||||||
|
//
|
||||||
|
// Conceptually, this type belongs in the blobstore package, but it lives in
|
||||||
|
// the appengine package to avoid a circular dependency: blobstore depends on
|
||||||
|
// datastore, and datastore needs to refer to the BlobKey type.
|
||||||
|
type BlobKey string
|
||||||
|
|
||||||
|
// GeoPoint represents a location as latitude/longitude in degrees.
|
||||||
|
type GeoPoint struct {
|
||||||
|
Lat, Lng float64
|
||||||
|
}
|
||||||
|
|
||||||
|
// Valid returns whether a GeoPoint is within [-90, 90] latitude and [-180, 180] longitude.
|
||||||
|
func (g GeoPoint) Valid() bool {
|
||||||
|
return -90 <= g.Lat && g.Lat <= 90 && -180 <= g.Lng && g.Lng <= 180
|
||||||
|
}
|
||||||
|
|
||||||
|
// APICallFunc defines a function type for handling an API call.
|
||||||
|
// See WithCallOverride.
|
||||||
|
type APICallFunc func(ctx context.Context, service, method string, in, out proto.Message) error
|
||||||
|
|
||||||
|
// WithAPICallFunc returns a copy of the parent context
|
||||||
|
// that will cause API calls to invoke f instead of their normal operation.
|
||||||
|
//
|
||||||
|
// This is intended for advanced users only.
|
||||||
|
func WithAPICallFunc(ctx context.Context, f APICallFunc) context.Context {
|
||||||
|
return internal.WithCallOverride(ctx, internal.CallOverrideFunc(f))
|
||||||
|
}
|
||||||
|
|
||||||
|
// APICall performs an API call.
|
||||||
|
//
|
||||||
|
// This is not intended for general use; it is exported for use in conjunction
|
||||||
|
// with WithAPICallFunc.
|
||||||
|
func APICall(ctx context.Context, service, method string, in, out proto.Message) error {
|
||||||
|
return internal.Call(ctx, service, method, in, out)
|
||||||
|
}
|
20
vendor/google.golang.org/appengine/appengine_vm.go
generated
vendored
Normal file
20
vendor/google.golang.org/appengine/appengine_vm.go
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
// Copyright 2015 Google Inc. All rights reserved.
|
||||||
|
// Use of this source code is governed by the Apache 2.0
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !appengine
|
||||||
|
|
||||||
|
package appengine
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
|
"google.golang.org/appengine/internal"
|
||||||
|
)
|
||||||
|
|
||||||
|
// BackgroundContext returns a context not associated with a request.
|
||||||
|
// This should only be used when not servicing a request.
|
||||||
|
// This only works in App Engine "flexible environment".
|
||||||
|
func BackgroundContext() context.Context {
|
||||||
|
return internal.BackgroundContext()
|
||||||
|
}
|
46
vendor/google.golang.org/appengine/errors.go
generated
vendored
Normal file
46
vendor/google.golang.org/appengine/errors.go
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
// Copyright 2011 Google Inc. All rights reserved.
|
||||||
|
// Use of this source code is governed by the Apache 2.0
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// This file provides error functions for common API failure modes.
|
||||||
|
|
||||||
|
package appengine
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"google.golang.org/appengine/internal"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IsOverQuota reports whether err represents an API call failure
|
||||||
|
// due to insufficient available quota.
|
||||||
|
func IsOverQuota(err error) bool {
|
||||||
|
callErr, ok := err.(*internal.CallError)
|
||||||
|
return ok && callErr.Code == 4
|
||||||
|
}
|
||||||
|
|
||||||
|
// MultiError is returned by batch operations when there are errors with
|
||||||
|
// particular elements. Errors will be in a one-to-one correspondence with
|
||||||
|
// the input elements; successful elements will have a nil entry.
|
||||||
|
type MultiError []error
|
||||||
|
|
||||||
|
func (m MultiError) Error() string {
|
||||||
|
s, n := "", 0
|
||||||
|
for _, e := range m {
|
||||||
|
if e != nil {
|
||||||
|
if n == 0 {
|
||||||
|
s = e.Error()
|
||||||
|
}
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch n {
|
||||||
|
case 0:
|
||||||
|
return "(0 errors)"
|
||||||
|
case 1:
|
||||||
|
return s
|
||||||
|
case 2:
|
||||||
|
return s + " (and 1 other error)"
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("%s (and %d other errors)", s, n-1)
|
||||||
|
}
|
10
vendor/google.golang.org/appengine/go.mod
generated
vendored
Normal file
10
vendor/google.golang.org/appengine/go.mod
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
module google.golang.org/appengine
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/golang/protobuf v1.3.1
|
||||||
|
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5 // indirect
|
||||||
|
golang.org/x/net v0.0.0-20190603091049-60506f45cf65
|
||||||
|
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c // indirect
|
||||||
|
golang.org/x/text v0.3.2
|
||||||
|
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b // indirect
|
||||||
|
)
|
22
vendor/google.golang.org/appengine/go.sum
generated
vendored
Normal file
22
vendor/google.golang.org/appengine/go.sum
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
|
||||||
|
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225 h1:kNX+jCowfMYzvlSvJu5pQWEmyWFrBXJ3PBy10xKMXK8=
|
||||||
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190603091049-60506f45cf65 h1:+rhAzEzT3f4JtomfC371qB+0Ola2caSKcY69NUBZrRQ=
|
||||||
|
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||||
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
142
vendor/google.golang.org/appengine/identity.go
generated
vendored
Normal file
142
vendor/google.golang.org/appengine/identity.go
generated
vendored
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
// Copyright 2011 Google Inc. All rights reserved.
|
||||||
|
// Use of this source code is governed by the Apache 2.0
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package appengine
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
|
"google.golang.org/appengine/internal"
|
||||||
|
pb "google.golang.org/appengine/internal/app_identity"
|
||||||
|
modpb "google.golang.org/appengine/internal/modules"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AppID returns the application ID for the current application.
|
||||||
|
// The string will be a plain application ID (e.g. "appid"), with a
|
||||||
|
// domain prefix for custom domain deployments (e.g. "example.com:appid").
|
||||||
|
func AppID(c context.Context) string { return internal.AppID(c) }
|
||||||
|
|
||||||
|
// DefaultVersionHostname returns the standard hostname of the default version
|
||||||
|
// of the current application (e.g. "my-app.appspot.com"). This is suitable for
|
||||||
|
// use in constructing URLs.
|
||||||
|
func DefaultVersionHostname(c context.Context) string {
|
||||||
|
return internal.DefaultVersionHostname(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ModuleName returns the module name of the current instance.
|
||||||
|
func ModuleName(c context.Context) string {
|
||||||
|
return internal.ModuleName(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ModuleHostname returns a hostname of a module instance.
|
||||||
|
// If module is the empty string, it refers to the module of the current instance.
|
||||||
|
// If version is empty, it refers to the version of the current instance if valid,
|
||||||
|
// or the default version of the module of the current instance.
|
||||||
|
// If instance is empty, ModuleHostname returns the load-balancing hostname.
|
||||||
|
func ModuleHostname(c context.Context, module, version, instance string) (string, error) {
|
||||||
|
req := &modpb.GetHostnameRequest{}
|
||||||
|
if module != "" {
|
||||||
|
req.Module = &module
|
||||||
|
}
|
||||||
|
if version != "" {
|
||||||
|
req.Version = &version
|
||||||
|
}
|
||||||
|
if instance != "" {
|
||||||
|
req.Instance = &instance
|
||||||
|
}
|
||||||
|
res := &modpb.GetHostnameResponse{}
|
||||||
|
if err := internal.Call(c, "modules", "GetHostname", req, res); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return *res.Hostname, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// VersionID returns the version ID for the current application.
|
||||||
|
// It will be of the form "X.Y", where X is specified in app.yaml,
|
||||||
|
// and Y is a number generated when each version of the app is uploaded.
|
||||||
|
// It does not include a module name.
|
||||||
|
func VersionID(c context.Context) string { return internal.VersionID(c) }
|
||||||
|
|
||||||
|
// InstanceID returns a mostly-unique identifier for this instance.
|
||||||
|
func InstanceID() string { return internal.InstanceID() }
|
||||||
|
|
||||||
|
// Datacenter returns an identifier for the datacenter that the instance is running in.
|
||||||
|
func Datacenter(c context.Context) string { return internal.Datacenter(c) }
|
||||||
|
|
||||||
|
// ServerSoftware returns the App Engine release version.
|
||||||
|
// In production, it looks like "Google App Engine/X.Y.Z".
|
||||||
|
// In the development appserver, it looks like "Development/X.Y".
|
||||||
|
func ServerSoftware() string { return internal.ServerSoftware() }
|
||||||
|
|
||||||
|
// RequestID returns a string that uniquely identifies the request.
|
||||||
|
func RequestID(c context.Context) string { return internal.RequestID(c) }
|
||||||
|
|
||||||
|
// AccessToken generates an OAuth2 access token for the specified scopes on
|
||||||
|
// behalf of service account of this application. This token will expire after
|
||||||
|
// the returned time.
|
||||||
|
func AccessToken(c context.Context, scopes ...string) (token string, expiry time.Time, err error) {
|
||||||
|
req := &pb.GetAccessTokenRequest{Scope: scopes}
|
||||||
|
res := &pb.GetAccessTokenResponse{}
|
||||||
|
|
||||||
|
err = internal.Call(c, "app_identity_service", "GetAccessToken", req, res)
|
||||||
|
if err != nil {
|
||||||
|
return "", time.Time{}, err
|
||||||
|
}
|
||||||
|
return res.GetAccessToken(), time.Unix(res.GetExpirationTime(), 0), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Certificate represents a public certificate for the app.
|
||||||
|
type Certificate struct {
|
||||||
|
KeyName string
|
||||||
|
Data []byte // PEM-encoded X.509 certificate
|
||||||
|
}
|
||||||
|
|
||||||
|
// PublicCertificates retrieves the public certificates for the app.
|
||||||
|
// They can be used to verify a signature returned by SignBytes.
|
||||||
|
func PublicCertificates(c context.Context) ([]Certificate, error) {
|
||||||
|
req := &pb.GetPublicCertificateForAppRequest{}
|
||||||
|
res := &pb.GetPublicCertificateForAppResponse{}
|
||||||
|
if err := internal.Call(c, "app_identity_service", "GetPublicCertificatesForApp", req, res); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var cs []Certificate
|
||||||
|
for _, pc := range res.PublicCertificateList {
|
||||||
|
cs = append(cs, Certificate{
|
||||||
|
KeyName: pc.GetKeyName(),
|
||||||
|
Data: []byte(pc.GetX509CertificatePem()),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return cs, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServiceAccount returns a string representing the service account name, in
|
||||||
|
// the form of an email address (typically app_id@appspot.gserviceaccount.com).
|
||||||
|
func ServiceAccount(c context.Context) (string, error) {
|
||||||
|
req := &pb.GetServiceAccountNameRequest{}
|
||||||
|
res := &pb.GetServiceAccountNameResponse{}
|
||||||
|
|
||||||
|
err := internal.Call(c, "app_identity_service", "GetServiceAccountName", req, res)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return res.GetServiceAccountName(), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// SignBytes signs bytes using a private key unique to your application.
|
||||||
|
func SignBytes(c context.Context, bytes []byte) (keyName string, signature []byte, err error) {
|
||||||
|
req := &pb.SignForAppRequest{BytesToSign: bytes}
|
||||||
|
res := &pb.SignForAppResponse{}
|
||||||
|
|
||||||
|
if err := internal.Call(c, "app_identity_service", "SignForApp", req, res); err != nil {
|
||||||
|
return "", nil, err
|
||||||
|
}
|
||||||
|
return res.GetKeyName(), res.GetSignatureBytes(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
internal.RegisterErrorCodeMap("app_identity_service", pb.AppIdentityServiceError_ErrorCode_name)
|
||||||
|
internal.RegisterErrorCodeMap("modules", modpb.ModulesServiceError_ErrorCode_name)
|
||||||
|
}
|
611
vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.pb.go
generated
vendored
Normal file
611
vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,611 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: google.golang.org/appengine/internal/app_identity/app_identity_service.proto
|
||||||
|
|
||||||
|
package app_identity
|
||||||
|
|
||||||
|
import proto "github.com/golang/protobuf/proto"
|
||||||
|
import fmt "fmt"
|
||||||
|
import math "math"
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
type AppIdentityServiceError_ErrorCode int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
AppIdentityServiceError_SUCCESS AppIdentityServiceError_ErrorCode = 0
|
||||||
|
AppIdentityServiceError_UNKNOWN_SCOPE AppIdentityServiceError_ErrorCode = 9
|
||||||
|
AppIdentityServiceError_BLOB_TOO_LARGE AppIdentityServiceError_ErrorCode = 1000
|
||||||
|
AppIdentityServiceError_DEADLINE_EXCEEDED AppIdentityServiceError_ErrorCode = 1001
|
||||||
|
AppIdentityServiceError_NOT_A_VALID_APP AppIdentityServiceError_ErrorCode = 1002
|
||||||
|
AppIdentityServiceError_UNKNOWN_ERROR AppIdentityServiceError_ErrorCode = 1003
|
||||||
|
AppIdentityServiceError_NOT_ALLOWED AppIdentityServiceError_ErrorCode = 1005
|
||||||
|
AppIdentityServiceError_NOT_IMPLEMENTED AppIdentityServiceError_ErrorCode = 1006
|
||||||
|
)
|
||||||
|
|
||||||
|
var AppIdentityServiceError_ErrorCode_name = map[int32]string{
|
||||||
|
0: "SUCCESS",
|
||||||
|
9: "UNKNOWN_SCOPE",
|
||||||
|
1000: "BLOB_TOO_LARGE",
|
||||||
|
1001: "DEADLINE_EXCEEDED",
|
||||||
|
1002: "NOT_A_VALID_APP",
|
||||||
|
1003: "UNKNOWN_ERROR",
|
||||||
|
1005: "NOT_ALLOWED",
|
||||||
|
1006: "NOT_IMPLEMENTED",
|
||||||
|
}
|
||||||
|
var AppIdentityServiceError_ErrorCode_value = map[string]int32{
|
||||||
|
"SUCCESS": 0,
|
||||||
|
"UNKNOWN_SCOPE": 9,
|
||||||
|
"BLOB_TOO_LARGE": 1000,
|
||||||
|
"DEADLINE_EXCEEDED": 1001,
|
||||||
|
"NOT_A_VALID_APP": 1002,
|
||||||
|
"UNKNOWN_ERROR": 1003,
|
||||||
|
"NOT_ALLOWED": 1005,
|
||||||
|
"NOT_IMPLEMENTED": 1006,
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x AppIdentityServiceError_ErrorCode) Enum() *AppIdentityServiceError_ErrorCode {
|
||||||
|
p := new(AppIdentityServiceError_ErrorCode)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
func (x AppIdentityServiceError_ErrorCode) String() string {
|
||||||
|
return proto.EnumName(AppIdentityServiceError_ErrorCode_name, int32(x))
|
||||||
|
}
|
||||||
|
func (x *AppIdentityServiceError_ErrorCode) UnmarshalJSON(data []byte) error {
|
||||||
|
value, err := proto.UnmarshalJSONEnum(AppIdentityServiceError_ErrorCode_value, data, "AppIdentityServiceError_ErrorCode")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*x = AppIdentityServiceError_ErrorCode(value)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (AppIdentityServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{0, 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
type AppIdentityServiceError struct {
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *AppIdentityServiceError) Reset() { *m = AppIdentityServiceError{} }
|
||||||
|
func (m *AppIdentityServiceError) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*AppIdentityServiceError) ProtoMessage() {}
|
||||||
|
func (*AppIdentityServiceError) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{0}
|
||||||
|
}
|
||||||
|
func (m *AppIdentityServiceError) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_AppIdentityServiceError.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *AppIdentityServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_AppIdentityServiceError.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *AppIdentityServiceError) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_AppIdentityServiceError.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *AppIdentityServiceError) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_AppIdentityServiceError.Size(m)
|
||||||
|
}
|
||||||
|
func (m *AppIdentityServiceError) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_AppIdentityServiceError.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_AppIdentityServiceError proto.InternalMessageInfo
|
||||||
|
|
||||||
|
type SignForAppRequest struct {
|
||||||
|
BytesToSign []byte `protobuf:"bytes,1,opt,name=bytes_to_sign,json=bytesToSign" json:"bytes_to_sign,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *SignForAppRequest) Reset() { *m = SignForAppRequest{} }
|
||||||
|
func (m *SignForAppRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*SignForAppRequest) ProtoMessage() {}
|
||||||
|
func (*SignForAppRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{1}
|
||||||
|
}
|
||||||
|
func (m *SignForAppRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_SignForAppRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *SignForAppRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_SignForAppRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *SignForAppRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_SignForAppRequest.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *SignForAppRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_SignForAppRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *SignForAppRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_SignForAppRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_SignForAppRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *SignForAppRequest) GetBytesToSign() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.BytesToSign
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type SignForAppResponse struct {
|
||||||
|
KeyName *string `protobuf:"bytes,1,opt,name=key_name,json=keyName" json:"key_name,omitempty"`
|
||||||
|
SignatureBytes []byte `protobuf:"bytes,2,opt,name=signature_bytes,json=signatureBytes" json:"signature_bytes,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *SignForAppResponse) Reset() { *m = SignForAppResponse{} }
|
||||||
|
func (m *SignForAppResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*SignForAppResponse) ProtoMessage() {}
|
||||||
|
func (*SignForAppResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{2}
|
||||||
|
}
|
||||||
|
func (m *SignForAppResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_SignForAppResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *SignForAppResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_SignForAppResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *SignForAppResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_SignForAppResponse.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *SignForAppResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_SignForAppResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *SignForAppResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_SignForAppResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_SignForAppResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *SignForAppResponse) GetKeyName() string {
|
||||||
|
if m != nil && m.KeyName != nil {
|
||||||
|
return *m.KeyName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *SignForAppResponse) GetSignatureBytes() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.SignatureBytes
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetPublicCertificateForAppRequest struct {
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetPublicCertificateForAppRequest) Reset() { *m = GetPublicCertificateForAppRequest{} }
|
||||||
|
func (m *GetPublicCertificateForAppRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetPublicCertificateForAppRequest) ProtoMessage() {}
|
||||||
|
func (*GetPublicCertificateForAppRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{3}
|
||||||
|
}
|
||||||
|
func (m *GetPublicCertificateForAppRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetPublicCertificateForAppRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetPublicCertificateForAppRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetPublicCertificateForAppRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetPublicCertificateForAppRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetPublicCertificateForAppRequest.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetPublicCertificateForAppRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetPublicCertificateForAppRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetPublicCertificateForAppRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetPublicCertificateForAppRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetPublicCertificateForAppRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
type PublicCertificate struct {
|
||||||
|
KeyName *string `protobuf:"bytes,1,opt,name=key_name,json=keyName" json:"key_name,omitempty"`
|
||||||
|
X509CertificatePem *string `protobuf:"bytes,2,opt,name=x509_certificate_pem,json=x509CertificatePem" json:"x509_certificate_pem,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PublicCertificate) Reset() { *m = PublicCertificate{} }
|
||||||
|
func (m *PublicCertificate) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*PublicCertificate) ProtoMessage() {}
|
||||||
|
func (*PublicCertificate) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{4}
|
||||||
|
}
|
||||||
|
func (m *PublicCertificate) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_PublicCertificate.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *PublicCertificate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_PublicCertificate.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *PublicCertificate) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_PublicCertificate.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *PublicCertificate) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_PublicCertificate.Size(m)
|
||||||
|
}
|
||||||
|
func (m *PublicCertificate) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_PublicCertificate.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_PublicCertificate proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *PublicCertificate) GetKeyName() string {
|
||||||
|
if m != nil && m.KeyName != nil {
|
||||||
|
return *m.KeyName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PublicCertificate) GetX509CertificatePem() string {
|
||||||
|
if m != nil && m.X509CertificatePem != nil {
|
||||||
|
return *m.X509CertificatePem
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetPublicCertificateForAppResponse struct {
|
||||||
|
PublicCertificateList []*PublicCertificate `protobuf:"bytes,1,rep,name=public_certificate_list,json=publicCertificateList" json:"public_certificate_list,omitempty"`
|
||||||
|
MaxClientCacheTimeInSecond *int64 `protobuf:"varint,2,opt,name=max_client_cache_time_in_second,json=maxClientCacheTimeInSecond" json:"max_client_cache_time_in_second,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetPublicCertificateForAppResponse) Reset() { *m = GetPublicCertificateForAppResponse{} }
|
||||||
|
func (m *GetPublicCertificateForAppResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetPublicCertificateForAppResponse) ProtoMessage() {}
|
||||||
|
func (*GetPublicCertificateForAppResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{5}
|
||||||
|
}
|
||||||
|
func (m *GetPublicCertificateForAppResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetPublicCertificateForAppResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetPublicCertificateForAppResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetPublicCertificateForAppResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetPublicCertificateForAppResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetPublicCertificateForAppResponse.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetPublicCertificateForAppResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetPublicCertificateForAppResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetPublicCertificateForAppResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetPublicCertificateForAppResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetPublicCertificateForAppResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetPublicCertificateForAppResponse) GetPublicCertificateList() []*PublicCertificate {
|
||||||
|
if m != nil {
|
||||||
|
return m.PublicCertificateList
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetPublicCertificateForAppResponse) GetMaxClientCacheTimeInSecond() int64 {
|
||||||
|
if m != nil && m.MaxClientCacheTimeInSecond != nil {
|
||||||
|
return *m.MaxClientCacheTimeInSecond
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetServiceAccountNameRequest struct {
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetServiceAccountNameRequest) Reset() { *m = GetServiceAccountNameRequest{} }
|
||||||
|
func (m *GetServiceAccountNameRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetServiceAccountNameRequest) ProtoMessage() {}
|
||||||
|
func (*GetServiceAccountNameRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{6}
|
||||||
|
}
|
||||||
|
func (m *GetServiceAccountNameRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetServiceAccountNameRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetServiceAccountNameRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetServiceAccountNameRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetServiceAccountNameRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetServiceAccountNameRequest.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetServiceAccountNameRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetServiceAccountNameRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetServiceAccountNameRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetServiceAccountNameRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetServiceAccountNameRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
type GetServiceAccountNameResponse struct {
|
||||||
|
ServiceAccountName *string `protobuf:"bytes,1,opt,name=service_account_name,json=serviceAccountName" json:"service_account_name,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetServiceAccountNameResponse) Reset() { *m = GetServiceAccountNameResponse{} }
|
||||||
|
func (m *GetServiceAccountNameResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetServiceAccountNameResponse) ProtoMessage() {}
|
||||||
|
func (*GetServiceAccountNameResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{7}
|
||||||
|
}
|
||||||
|
func (m *GetServiceAccountNameResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetServiceAccountNameResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetServiceAccountNameResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetServiceAccountNameResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetServiceAccountNameResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetServiceAccountNameResponse.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetServiceAccountNameResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetServiceAccountNameResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetServiceAccountNameResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetServiceAccountNameResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetServiceAccountNameResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetServiceAccountNameResponse) GetServiceAccountName() string {
|
||||||
|
if m != nil && m.ServiceAccountName != nil {
|
||||||
|
return *m.ServiceAccountName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetAccessTokenRequest struct {
|
||||||
|
Scope []string `protobuf:"bytes,1,rep,name=scope" json:"scope,omitempty"`
|
||||||
|
ServiceAccountId *int64 `protobuf:"varint,2,opt,name=service_account_id,json=serviceAccountId" json:"service_account_id,omitempty"`
|
||||||
|
ServiceAccountName *string `protobuf:"bytes,3,opt,name=service_account_name,json=serviceAccountName" json:"service_account_name,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetAccessTokenRequest) Reset() { *m = GetAccessTokenRequest{} }
|
||||||
|
func (m *GetAccessTokenRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetAccessTokenRequest) ProtoMessage() {}
|
||||||
|
func (*GetAccessTokenRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{8}
|
||||||
|
}
|
||||||
|
func (m *GetAccessTokenRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetAccessTokenRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetAccessTokenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetAccessTokenRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetAccessTokenRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetAccessTokenRequest.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetAccessTokenRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetAccessTokenRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetAccessTokenRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetAccessTokenRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetAccessTokenRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetAccessTokenRequest) GetScope() []string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Scope
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetAccessTokenRequest) GetServiceAccountId() int64 {
|
||||||
|
if m != nil && m.ServiceAccountId != nil {
|
||||||
|
return *m.ServiceAccountId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetAccessTokenRequest) GetServiceAccountName() string {
|
||||||
|
if m != nil && m.ServiceAccountName != nil {
|
||||||
|
return *m.ServiceAccountName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetAccessTokenResponse struct {
|
||||||
|
AccessToken *string `protobuf:"bytes,1,opt,name=access_token,json=accessToken" json:"access_token,omitempty"`
|
||||||
|
ExpirationTime *int64 `protobuf:"varint,2,opt,name=expiration_time,json=expirationTime" json:"expiration_time,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetAccessTokenResponse) Reset() { *m = GetAccessTokenResponse{} }
|
||||||
|
func (m *GetAccessTokenResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetAccessTokenResponse) ProtoMessage() {}
|
||||||
|
func (*GetAccessTokenResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{9}
|
||||||
|
}
|
||||||
|
func (m *GetAccessTokenResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetAccessTokenResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetAccessTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetAccessTokenResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetAccessTokenResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetAccessTokenResponse.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetAccessTokenResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetAccessTokenResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetAccessTokenResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetAccessTokenResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetAccessTokenResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetAccessTokenResponse) GetAccessToken() string {
|
||||||
|
if m != nil && m.AccessToken != nil {
|
||||||
|
return *m.AccessToken
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetAccessTokenResponse) GetExpirationTime() int64 {
|
||||||
|
if m != nil && m.ExpirationTime != nil {
|
||||||
|
return *m.ExpirationTime
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetDefaultGcsBucketNameRequest struct {
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetDefaultGcsBucketNameRequest) Reset() { *m = GetDefaultGcsBucketNameRequest{} }
|
||||||
|
func (m *GetDefaultGcsBucketNameRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetDefaultGcsBucketNameRequest) ProtoMessage() {}
|
||||||
|
func (*GetDefaultGcsBucketNameRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{10}
|
||||||
|
}
|
||||||
|
func (m *GetDefaultGcsBucketNameRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetDefaultGcsBucketNameRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetDefaultGcsBucketNameRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetDefaultGcsBucketNameRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetDefaultGcsBucketNameRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetDefaultGcsBucketNameRequest.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetDefaultGcsBucketNameRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetDefaultGcsBucketNameRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetDefaultGcsBucketNameRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetDefaultGcsBucketNameRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetDefaultGcsBucketNameRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
type GetDefaultGcsBucketNameResponse struct {
|
||||||
|
DefaultGcsBucketName *string `protobuf:"bytes,1,opt,name=default_gcs_bucket_name,json=defaultGcsBucketName" json:"default_gcs_bucket_name,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetDefaultGcsBucketNameResponse) Reset() { *m = GetDefaultGcsBucketNameResponse{} }
|
||||||
|
func (m *GetDefaultGcsBucketNameResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetDefaultGcsBucketNameResponse) ProtoMessage() {}
|
||||||
|
func (*GetDefaultGcsBucketNameResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{11}
|
||||||
|
}
|
||||||
|
func (m *GetDefaultGcsBucketNameResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetDefaultGcsBucketNameResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetDefaultGcsBucketNameResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetDefaultGcsBucketNameResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetDefaultGcsBucketNameResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetDefaultGcsBucketNameResponse.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetDefaultGcsBucketNameResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetDefaultGcsBucketNameResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetDefaultGcsBucketNameResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetDefaultGcsBucketNameResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetDefaultGcsBucketNameResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetDefaultGcsBucketNameResponse) GetDefaultGcsBucketName() string {
|
||||||
|
if m != nil && m.DefaultGcsBucketName != nil {
|
||||||
|
return *m.DefaultGcsBucketName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*AppIdentityServiceError)(nil), "appengine.AppIdentityServiceError")
|
||||||
|
proto.RegisterType((*SignForAppRequest)(nil), "appengine.SignForAppRequest")
|
||||||
|
proto.RegisterType((*SignForAppResponse)(nil), "appengine.SignForAppResponse")
|
||||||
|
proto.RegisterType((*GetPublicCertificateForAppRequest)(nil), "appengine.GetPublicCertificateForAppRequest")
|
||||||
|
proto.RegisterType((*PublicCertificate)(nil), "appengine.PublicCertificate")
|
||||||
|
proto.RegisterType((*GetPublicCertificateForAppResponse)(nil), "appengine.GetPublicCertificateForAppResponse")
|
||||||
|
proto.RegisterType((*GetServiceAccountNameRequest)(nil), "appengine.GetServiceAccountNameRequest")
|
||||||
|
proto.RegisterType((*GetServiceAccountNameResponse)(nil), "appengine.GetServiceAccountNameResponse")
|
||||||
|
proto.RegisterType((*GetAccessTokenRequest)(nil), "appengine.GetAccessTokenRequest")
|
||||||
|
proto.RegisterType((*GetAccessTokenResponse)(nil), "appengine.GetAccessTokenResponse")
|
||||||
|
proto.RegisterType((*GetDefaultGcsBucketNameRequest)(nil), "appengine.GetDefaultGcsBucketNameRequest")
|
||||||
|
proto.RegisterType((*GetDefaultGcsBucketNameResponse)(nil), "appengine.GetDefaultGcsBucketNameResponse")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterFile("google.golang.org/appengine/internal/app_identity/app_identity_service.proto", fileDescriptor_app_identity_service_08a6e3f74b04cfa4)
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileDescriptor_app_identity_service_08a6e3f74b04cfa4 = []byte{
|
||||||
|
// 676 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xdb, 0x6e, 0xda, 0x58,
|
||||||
|
0x14, 0x1d, 0x26, 0x1a, 0x31, 0x6c, 0x12, 0x62, 0xce, 0x90, 0xcb, 0x8c, 0x32, 0xb9, 0x78, 0x1e,
|
||||||
|
0x26, 0x0f, 0x15, 0x89, 0x2a, 0x45, 0x55, 0x1f, 0x8d, 0xed, 0x22, 0x54, 0x07, 0x53, 0x43, 0x9a,
|
||||||
|
0xa8, 0x2f, 0xa7, 0xce, 0x61, 0xc7, 0x3d, 0x02, 0x9f, 0xe3, 0xda, 0x87, 0x0a, 0x3e, 0xa2, 0x3f,
|
||||||
|
0xd2, 0x9f, 0xe8, 0x5b, 0xbf, 0xa5, 0x17, 0xb5, 0xdf, 0x50, 0xd9, 0x38, 0x5c, 0x92, 0x92, 0x37,
|
||||||
|
0xbc, 0xf6, 0x5a, 0xcb, 0x6b, 0x2f, 0x6d, 0x0c, 0x4e, 0x20, 0x65, 0x30, 0xc4, 0x7a, 0x20, 0x87,
|
||||||
|
0xbe, 0x08, 0xea, 0x32, 0x0e, 0x4e, 0xfc, 0x28, 0x42, 0x11, 0x70, 0x81, 0x27, 0x5c, 0x28, 0x8c,
|
||||||
|
0x85, 0x3f, 0x4c, 0x21, 0xca, 0xfb, 0x28, 0x14, 0x57, 0x93, 0xa5, 0x07, 0x9a, 0x60, 0xfc, 0x8e,
|
||||||
|
0x33, 0xac, 0x47, 0xb1, 0x54, 0x92, 0x94, 0x66, 0x5a, 0xfd, 0x53, 0x01, 0x76, 0x8c, 0x28, 0x6a,
|
||||||
|
0xe5, 0xc4, 0xee, 0x94, 0x67, 0xc7, 0xb1, 0x8c, 0xf5, 0x0f, 0x05, 0x28, 0x65, 0xbf, 0x4c, 0xd9,
|
||||||
|
0x47, 0x52, 0x86, 0x62, 0xf7, 0xc2, 0x34, 0xed, 0x6e, 0x57, 0xfb, 0x8d, 0x54, 0x61, 0xe3, 0xa2,
|
||||||
|
0xfd, 0xbc, 0xed, 0x5e, 0xb6, 0x69, 0xd7, 0x74, 0x3b, 0xb6, 0x56, 0x22, 0x7f, 0x41, 0xa5, 0xe1,
|
||||||
|
0xb8, 0x0d, 0xda, 0x73, 0x5d, 0xea, 0x18, 0x5e, 0xd3, 0xd6, 0x3e, 0x17, 0xc9, 0x36, 0x54, 0x2d,
|
||||||
|
0xdb, 0xb0, 0x9c, 0x56, 0xdb, 0xa6, 0xf6, 0x95, 0x69, 0xdb, 0x96, 0x6d, 0x69, 0x5f, 0x8a, 0xa4,
|
||||||
|
0x06, 0x9b, 0x6d, 0xb7, 0x47, 0x0d, 0xfa, 0xd2, 0x70, 0x5a, 0x16, 0x35, 0x3a, 0x1d, 0xed, 0x6b,
|
||||||
|
0x91, 0x90, 0xb9, 0xab, 0xed, 0x79, 0xae, 0xa7, 0x7d, 0x2b, 0x12, 0x0d, 0xca, 0x19, 0xd3, 0x71,
|
||||||
|
0xdc, 0x4b, 0xdb, 0xd2, 0xbe, 0xcf, 0xb4, 0xad, 0xf3, 0x8e, 0x63, 0x9f, 0xdb, 0xed, 0x9e, 0x6d,
|
||||||
|
0x69, 0x3f, 0x8a, 0xfa, 0x13, 0xa8, 0x76, 0x79, 0x20, 0x9e, 0xc9, 0xd8, 0x88, 0x22, 0x0f, 0xdf,
|
||||||
|
0x8e, 0x30, 0x51, 0x44, 0x87, 0x8d, 0xeb, 0x89, 0xc2, 0x84, 0x2a, 0x49, 0x13, 0x1e, 0x88, 0xdd,
|
||||||
|
0xc2, 0x61, 0xe1, 0x78, 0xdd, 0x2b, 0x67, 0x60, 0x4f, 0xa6, 0x02, 0xfd, 0x0a, 0xc8, 0xa2, 0x30,
|
||||||
|
0x89, 0xa4, 0x48, 0x90, 0xfc, 0x0d, 0x7f, 0x0e, 0x70, 0x42, 0x85, 0x1f, 0x62, 0x26, 0x2a, 0x79,
|
||||||
|
0xc5, 0x01, 0x4e, 0xda, 0x7e, 0x88, 0xe4, 0x7f, 0xd8, 0x4c, 0xbd, 0x7c, 0x35, 0x8a, 0x91, 0x66,
|
||||||
|
0x4e, 0xbb, 0xbf, 0x67, 0xb6, 0x95, 0x19, 0xdc, 0x48, 0x51, 0xfd, 0x3f, 0x38, 0x6a, 0xa2, 0xea,
|
||||||
|
0x8c, 0xae, 0x87, 0x9c, 0x99, 0x18, 0x2b, 0x7e, 0xc3, 0x99, 0xaf, 0x70, 0x29, 0xa2, 0xfe, 0x1a,
|
||||||
|
0xaa, 0xf7, 0x18, 0x0f, 0xbd, 0xfd, 0x14, 0x6a, 0xe3, 0xb3, 0xd3, 0xa7, 0x94, 0xcd, 0xe9, 0x34,
|
||||||
|
0xc2, 0x30, 0x8b, 0x50, 0xf2, 0x48, 0x3a, 0x5b, 0x70, 0xea, 0x60, 0xa8, 0x7f, 0x2c, 0x80, 0xfe,
|
||||||
|
0x50, 0x8e, 0x7c, 0xe3, 0x1e, 0xec, 0x44, 0x19, 0x65, 0xc9, 0x7a, 0xc8, 0x13, 0xb5, 0x5b, 0x38,
|
||||||
|
0x5c, 0x3b, 0x2e, 0x3f, 0xde, 0xab, 0xcf, 0xce, 0xa6, 0x7e, 0xcf, 0xcc, 0xdb, 0x8a, 0xee, 0x42,
|
||||||
|
0x0e, 0x4f, 0x14, 0x31, 0xe1, 0x20, 0xf4, 0xc7, 0x94, 0x0d, 0x39, 0x0a, 0x45, 0x99, 0xcf, 0xde,
|
||||||
|
0x20, 0x55, 0x3c, 0x44, 0xca, 0x05, 0x4d, 0x90, 0x49, 0xd1, 0xcf, 0x92, 0xaf, 0x79, 0xff, 0x84,
|
||||||
|
0xfe, 0xd8, 0xcc, 0x58, 0x66, 0x4a, 0xea, 0xf1, 0x10, 0x5b, 0xa2, 0x9b, 0x31, 0xf4, 0x7d, 0xd8,
|
||||||
|
0x6b, 0xa2, 0xca, 0x6f, 0xd3, 0x60, 0x4c, 0x8e, 0x84, 0x4a, 0xcb, 0xb8, 0xed, 0xf0, 0x05, 0xfc,
|
||||||
|
0xbb, 0x62, 0x9e, 0xef, 0x76, 0x0a, 0xb5, 0xfc, 0x1f, 0x40, 0xfd, 0xe9, 0x78, 0xb1, 0x5b, 0x92,
|
||||||
|
0xdc, 0x53, 0xea, 0xef, 0x0b, 0xb0, 0xd5, 0x44, 0x65, 0x30, 0x86, 0x49, 0xd2, 0x93, 0x03, 0x14,
|
||||||
|
0xb7, 0x37, 0x55, 0x83, 0x3f, 0x12, 0x26, 0x23, 0xcc, 0x5a, 0x29, 0x79, 0xd3, 0x07, 0xf2, 0x08,
|
||||||
|
0xc8, 0xdd, 0x37, 0xf0, 0xdb, 0xd5, 0xb4, 0x65, 0xff, 0x56, 0x7f, 0x65, 0x9e, 0xb5, 0x95, 0x79,
|
||||||
|
0xfa, 0xb0, 0x7d, 0x37, 0x4e, 0xbe, 0xdb, 0x11, 0xac, 0xfb, 0x19, 0x4c, 0x55, 0x8a, 0xe7, 0x3b,
|
||||||
|
0x95, 0xfd, 0x39, 0x35, 0xbd, 0x58, 0x1c, 0x47, 0x3c, 0xf6, 0x15, 0x97, 0x22, 0xab, 0x3f, 0x4f,
|
||||||
|
0x56, 0x99, 0xc3, 0x69, 0xe1, 0xfa, 0x21, 0xec, 0x37, 0x51, 0x59, 0x78, 0xe3, 0x8f, 0x86, 0xaa,
|
||||||
|
0xc9, 0x92, 0xc6, 0x88, 0x0d, 0x70, 0xa9, 0xea, 0x2b, 0x38, 0x58, 0xc9, 0xc8, 0x03, 0x9d, 0xc1,
|
||||||
|
0x4e, 0x7f, 0x3a, 0xa7, 0x01, 0x4b, 0xe8, 0x75, 0xc6, 0x58, 0xec, 0xbb, 0xd6, 0xff, 0x85, 0xbc,
|
||||||
|
0x51, 0x79, 0xb5, 0xbe, 0xf8, 0xc9, 0xfa, 0x19, 0x00, 0x00, 0xff, 0xff, 0x37, 0x4c, 0x56, 0x38,
|
||||||
|
0xf3, 0x04, 0x00, 0x00,
|
||||||
|
}
|
64
vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.proto
generated
vendored
Normal file
64
vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.proto
generated
vendored
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
syntax = "proto2";
|
||||||
|
option go_package = "app_identity";
|
||||||
|
|
||||||
|
package appengine;
|
||||||
|
|
||||||
|
message AppIdentityServiceError {
|
||||||
|
enum ErrorCode {
|
||||||
|
SUCCESS = 0;
|
||||||
|
UNKNOWN_SCOPE = 9;
|
||||||
|
BLOB_TOO_LARGE = 1000;
|
||||||
|
DEADLINE_EXCEEDED = 1001;
|
||||||
|
NOT_A_VALID_APP = 1002;
|
||||||
|
UNKNOWN_ERROR = 1003;
|
||||||
|
NOT_ALLOWED = 1005;
|
||||||
|
NOT_IMPLEMENTED = 1006;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message SignForAppRequest {
|
||||||
|
optional bytes bytes_to_sign = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SignForAppResponse {
|
||||||
|
optional string key_name = 1;
|
||||||
|
optional bytes signature_bytes = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetPublicCertificateForAppRequest {
|
||||||
|
}
|
||||||
|
|
||||||
|
message PublicCertificate {
|
||||||
|
optional string key_name = 1;
|
||||||
|
optional string x509_certificate_pem = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetPublicCertificateForAppResponse {
|
||||||
|
repeated PublicCertificate public_certificate_list = 1;
|
||||||
|
optional int64 max_client_cache_time_in_second = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetServiceAccountNameRequest {
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetServiceAccountNameResponse {
|
||||||
|
optional string service_account_name = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetAccessTokenRequest {
|
||||||
|
repeated string scope = 1;
|
||||||
|
optional int64 service_account_id = 2;
|
||||||
|
optional string service_account_name = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetAccessTokenResponse {
|
||||||
|
optional string access_token = 1;
|
||||||
|
optional int64 expiration_time = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetDefaultGcsBucketNameRequest {
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetDefaultGcsBucketNameResponse {
|
||||||
|
optional string default_gcs_bucket_name = 1;
|
||||||
|
}
|
786
vendor/google.golang.org/appengine/internal/modules/modules_service.pb.go
generated
vendored
Normal file
786
vendor/google.golang.org/appengine/internal/modules/modules_service.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,786 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: google.golang.org/appengine/internal/modules/modules_service.proto
|
||||||
|
|
||||||
|
package modules
|
||||||
|
|
||||||
|
import proto "github.com/golang/protobuf/proto"
|
||||||
|
import fmt "fmt"
|
||||||
|
import math "math"
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
type ModulesServiceError_ErrorCode int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
ModulesServiceError_OK ModulesServiceError_ErrorCode = 0
|
||||||
|
ModulesServiceError_INVALID_MODULE ModulesServiceError_ErrorCode = 1
|
||||||
|
ModulesServiceError_INVALID_VERSION ModulesServiceError_ErrorCode = 2
|
||||||
|
ModulesServiceError_INVALID_INSTANCES ModulesServiceError_ErrorCode = 3
|
||||||
|
ModulesServiceError_TRANSIENT_ERROR ModulesServiceError_ErrorCode = 4
|
||||||
|
ModulesServiceError_UNEXPECTED_STATE ModulesServiceError_ErrorCode = 5
|
||||||
|
)
|
||||||
|
|
||||||
|
var ModulesServiceError_ErrorCode_name = map[int32]string{
|
||||||
|
0: "OK",
|
||||||
|
1: "INVALID_MODULE",
|
||||||
|
2: "INVALID_VERSION",
|
||||||
|
3: "INVALID_INSTANCES",
|
||||||
|
4: "TRANSIENT_ERROR",
|
||||||
|
5: "UNEXPECTED_STATE",
|
||||||
|
}
|
||||||
|
var ModulesServiceError_ErrorCode_value = map[string]int32{
|
||||||
|
"OK": 0,
|
||||||
|
"INVALID_MODULE": 1,
|
||||||
|
"INVALID_VERSION": 2,
|
||||||
|
"INVALID_INSTANCES": 3,
|
||||||
|
"TRANSIENT_ERROR": 4,
|
||||||
|
"UNEXPECTED_STATE": 5,
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x ModulesServiceError_ErrorCode) Enum() *ModulesServiceError_ErrorCode {
|
||||||
|
p := new(ModulesServiceError_ErrorCode)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
func (x ModulesServiceError_ErrorCode) String() string {
|
||||||
|
return proto.EnumName(ModulesServiceError_ErrorCode_name, int32(x))
|
||||||
|
}
|
||||||
|
func (x *ModulesServiceError_ErrorCode) UnmarshalJSON(data []byte) error {
|
||||||
|
value, err := proto.UnmarshalJSONEnum(ModulesServiceError_ErrorCode_value, data, "ModulesServiceError_ErrorCode")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*x = ModulesServiceError_ErrorCode(value)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (ModulesServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{0, 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
type ModulesServiceError struct {
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ModulesServiceError) Reset() { *m = ModulesServiceError{} }
|
||||||
|
func (m *ModulesServiceError) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*ModulesServiceError) ProtoMessage() {}
|
||||||
|
func (*ModulesServiceError) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{0}
|
||||||
|
}
|
||||||
|
func (m *ModulesServiceError) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_ModulesServiceError.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *ModulesServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_ModulesServiceError.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *ModulesServiceError) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_ModulesServiceError.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *ModulesServiceError) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_ModulesServiceError.Size(m)
|
||||||
|
}
|
||||||
|
func (m *ModulesServiceError) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_ModulesServiceError.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_ModulesServiceError proto.InternalMessageInfo
|
||||||
|
|
||||||
|
type GetModulesRequest struct {
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetModulesRequest) Reset() { *m = GetModulesRequest{} }
|
||||||
|
func (m *GetModulesRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetModulesRequest) ProtoMessage() {}
|
||||||
|
func (*GetModulesRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{1}
|
||||||
|
}
|
||||||
|
func (m *GetModulesRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetModulesRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetModulesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetModulesRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetModulesRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetModulesRequest.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetModulesRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetModulesRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetModulesRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetModulesRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetModulesRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
type GetModulesResponse struct {
|
||||||
|
Module []string `protobuf:"bytes,1,rep,name=module" json:"module,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetModulesResponse) Reset() { *m = GetModulesResponse{} }
|
||||||
|
func (m *GetModulesResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetModulesResponse) ProtoMessage() {}
|
||||||
|
func (*GetModulesResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{2}
|
||||||
|
}
|
||||||
|
func (m *GetModulesResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetModulesResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetModulesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetModulesResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetModulesResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetModulesResponse.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetModulesResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetModulesResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetModulesResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetModulesResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetModulesResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetModulesResponse) GetModule() []string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Module
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetVersionsRequest struct {
|
||||||
|
Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetVersionsRequest) Reset() { *m = GetVersionsRequest{} }
|
||||||
|
func (m *GetVersionsRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetVersionsRequest) ProtoMessage() {}
|
||||||
|
func (*GetVersionsRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{3}
|
||||||
|
}
|
||||||
|
func (m *GetVersionsRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetVersionsRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetVersionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetVersionsRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetVersionsRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetVersionsRequest.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetVersionsRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetVersionsRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetVersionsRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetVersionsRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetVersionsRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetVersionsRequest) GetModule() string {
|
||||||
|
if m != nil && m.Module != nil {
|
||||||
|
return *m.Module
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetVersionsResponse struct {
|
||||||
|
Version []string `protobuf:"bytes,1,rep,name=version" json:"version,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetVersionsResponse) Reset() { *m = GetVersionsResponse{} }
|
||||||
|
func (m *GetVersionsResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetVersionsResponse) ProtoMessage() {}
|
||||||
|
func (*GetVersionsResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{4}
|
||||||
|
}
|
||||||
|
func (m *GetVersionsResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetVersionsResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetVersionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetVersionsResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetVersionsResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetVersionsResponse.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetVersionsResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetVersionsResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetVersionsResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetVersionsResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetVersionsResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetVersionsResponse) GetVersion() []string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Version
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetDefaultVersionRequest struct {
|
||||||
|
Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetDefaultVersionRequest) Reset() { *m = GetDefaultVersionRequest{} }
|
||||||
|
func (m *GetDefaultVersionRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetDefaultVersionRequest) ProtoMessage() {}
|
||||||
|
func (*GetDefaultVersionRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{5}
|
||||||
|
}
|
||||||
|
func (m *GetDefaultVersionRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetDefaultVersionRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetDefaultVersionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetDefaultVersionRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetDefaultVersionRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetDefaultVersionRequest.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetDefaultVersionRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetDefaultVersionRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetDefaultVersionRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetDefaultVersionRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetDefaultVersionRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetDefaultVersionRequest) GetModule() string {
|
||||||
|
if m != nil && m.Module != nil {
|
||||||
|
return *m.Module
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetDefaultVersionResponse struct {
|
||||||
|
Version *string `protobuf:"bytes,1,req,name=version" json:"version,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetDefaultVersionResponse) Reset() { *m = GetDefaultVersionResponse{} }
|
||||||
|
func (m *GetDefaultVersionResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetDefaultVersionResponse) ProtoMessage() {}
|
||||||
|
func (*GetDefaultVersionResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{6}
|
||||||
|
}
|
||||||
|
func (m *GetDefaultVersionResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetDefaultVersionResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetDefaultVersionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetDefaultVersionResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetDefaultVersionResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetDefaultVersionResponse.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetDefaultVersionResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetDefaultVersionResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetDefaultVersionResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetDefaultVersionResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetDefaultVersionResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetDefaultVersionResponse) GetVersion() string {
|
||||||
|
if m != nil && m.Version != nil {
|
||||||
|
return *m.Version
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetNumInstancesRequest struct {
|
||||||
|
Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"`
|
||||||
|
Version *string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetNumInstancesRequest) Reset() { *m = GetNumInstancesRequest{} }
|
||||||
|
func (m *GetNumInstancesRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetNumInstancesRequest) ProtoMessage() {}
|
||||||
|
func (*GetNumInstancesRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{7}
|
||||||
|
}
|
||||||
|
func (m *GetNumInstancesRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetNumInstancesRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetNumInstancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetNumInstancesRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetNumInstancesRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetNumInstancesRequest.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetNumInstancesRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetNumInstancesRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetNumInstancesRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetNumInstancesRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetNumInstancesRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetNumInstancesRequest) GetModule() string {
|
||||||
|
if m != nil && m.Module != nil {
|
||||||
|
return *m.Module
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetNumInstancesRequest) GetVersion() string {
|
||||||
|
if m != nil && m.Version != nil {
|
||||||
|
return *m.Version
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetNumInstancesResponse struct {
|
||||||
|
Instances *int64 `protobuf:"varint,1,req,name=instances" json:"instances,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetNumInstancesResponse) Reset() { *m = GetNumInstancesResponse{} }
|
||||||
|
func (m *GetNumInstancesResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetNumInstancesResponse) ProtoMessage() {}
|
||||||
|
func (*GetNumInstancesResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{8}
|
||||||
|
}
|
||||||
|
func (m *GetNumInstancesResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetNumInstancesResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetNumInstancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetNumInstancesResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetNumInstancesResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetNumInstancesResponse.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetNumInstancesResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetNumInstancesResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetNumInstancesResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetNumInstancesResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetNumInstancesResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetNumInstancesResponse) GetInstances() int64 {
|
||||||
|
if m != nil && m.Instances != nil {
|
||||||
|
return *m.Instances
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type SetNumInstancesRequest struct {
|
||||||
|
Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"`
|
||||||
|
Version *string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"`
|
||||||
|
Instances *int64 `protobuf:"varint,3,req,name=instances" json:"instances,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *SetNumInstancesRequest) Reset() { *m = SetNumInstancesRequest{} }
|
||||||
|
func (m *SetNumInstancesRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*SetNumInstancesRequest) ProtoMessage() {}
|
||||||
|
func (*SetNumInstancesRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{9}
|
||||||
|
}
|
||||||
|
func (m *SetNumInstancesRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_SetNumInstancesRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *SetNumInstancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_SetNumInstancesRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *SetNumInstancesRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_SetNumInstancesRequest.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *SetNumInstancesRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_SetNumInstancesRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *SetNumInstancesRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_SetNumInstancesRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_SetNumInstancesRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *SetNumInstancesRequest) GetModule() string {
|
||||||
|
if m != nil && m.Module != nil {
|
||||||
|
return *m.Module
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *SetNumInstancesRequest) GetVersion() string {
|
||||||
|
if m != nil && m.Version != nil {
|
||||||
|
return *m.Version
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *SetNumInstancesRequest) GetInstances() int64 {
|
||||||
|
if m != nil && m.Instances != nil {
|
||||||
|
return *m.Instances
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type SetNumInstancesResponse struct {
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *SetNumInstancesResponse) Reset() { *m = SetNumInstancesResponse{} }
|
||||||
|
func (m *SetNumInstancesResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*SetNumInstancesResponse) ProtoMessage() {}
|
||||||
|
func (*SetNumInstancesResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{10}
|
||||||
|
}
|
||||||
|
func (m *SetNumInstancesResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_SetNumInstancesResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *SetNumInstancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_SetNumInstancesResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *SetNumInstancesResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_SetNumInstancesResponse.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *SetNumInstancesResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_SetNumInstancesResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *SetNumInstancesResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_SetNumInstancesResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_SetNumInstancesResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
type StartModuleRequest struct {
|
||||||
|
Module *string `protobuf:"bytes,1,req,name=module" json:"module,omitempty"`
|
||||||
|
Version *string `protobuf:"bytes,2,req,name=version" json:"version,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *StartModuleRequest) Reset() { *m = StartModuleRequest{} }
|
||||||
|
func (m *StartModuleRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*StartModuleRequest) ProtoMessage() {}
|
||||||
|
func (*StartModuleRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{11}
|
||||||
|
}
|
||||||
|
func (m *StartModuleRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_StartModuleRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *StartModuleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_StartModuleRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *StartModuleRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_StartModuleRequest.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *StartModuleRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_StartModuleRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *StartModuleRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_StartModuleRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_StartModuleRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *StartModuleRequest) GetModule() string {
|
||||||
|
if m != nil && m.Module != nil {
|
||||||
|
return *m.Module
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *StartModuleRequest) GetVersion() string {
|
||||||
|
if m != nil && m.Version != nil {
|
||||||
|
return *m.Version
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type StartModuleResponse struct {
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *StartModuleResponse) Reset() { *m = StartModuleResponse{} }
|
||||||
|
func (m *StartModuleResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*StartModuleResponse) ProtoMessage() {}
|
||||||
|
func (*StartModuleResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{12}
|
||||||
|
}
|
||||||
|
func (m *StartModuleResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_StartModuleResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *StartModuleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_StartModuleResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *StartModuleResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_StartModuleResponse.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *StartModuleResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_StartModuleResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *StartModuleResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_StartModuleResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_StartModuleResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
type StopModuleRequest struct {
|
||||||
|
Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"`
|
||||||
|
Version *string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *StopModuleRequest) Reset() { *m = StopModuleRequest{} }
|
||||||
|
func (m *StopModuleRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*StopModuleRequest) ProtoMessage() {}
|
||||||
|
func (*StopModuleRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{13}
|
||||||
|
}
|
||||||
|
func (m *StopModuleRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_StopModuleRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *StopModuleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_StopModuleRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *StopModuleRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_StopModuleRequest.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *StopModuleRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_StopModuleRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *StopModuleRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_StopModuleRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_StopModuleRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *StopModuleRequest) GetModule() string {
|
||||||
|
if m != nil && m.Module != nil {
|
||||||
|
return *m.Module
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *StopModuleRequest) GetVersion() string {
|
||||||
|
if m != nil && m.Version != nil {
|
||||||
|
return *m.Version
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type StopModuleResponse struct {
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *StopModuleResponse) Reset() { *m = StopModuleResponse{} }
|
||||||
|
func (m *StopModuleResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*StopModuleResponse) ProtoMessage() {}
|
||||||
|
func (*StopModuleResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{14}
|
||||||
|
}
|
||||||
|
func (m *StopModuleResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_StopModuleResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *StopModuleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_StopModuleResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *StopModuleResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_StopModuleResponse.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *StopModuleResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_StopModuleResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *StopModuleResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_StopModuleResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_StopModuleResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
type GetHostnameRequest struct {
|
||||||
|
Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"`
|
||||||
|
Version *string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"`
|
||||||
|
Instance *string `protobuf:"bytes,3,opt,name=instance" json:"instance,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetHostnameRequest) Reset() { *m = GetHostnameRequest{} }
|
||||||
|
func (m *GetHostnameRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetHostnameRequest) ProtoMessage() {}
|
||||||
|
func (*GetHostnameRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{15}
|
||||||
|
}
|
||||||
|
func (m *GetHostnameRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetHostnameRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetHostnameRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetHostnameRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetHostnameRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetHostnameRequest.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetHostnameRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetHostnameRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetHostnameRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetHostnameRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetHostnameRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetHostnameRequest) GetModule() string {
|
||||||
|
if m != nil && m.Module != nil {
|
||||||
|
return *m.Module
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetHostnameRequest) GetVersion() string {
|
||||||
|
if m != nil && m.Version != nil {
|
||||||
|
return *m.Version
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetHostnameRequest) GetInstance() string {
|
||||||
|
if m != nil && m.Instance != nil {
|
||||||
|
return *m.Instance
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetHostnameResponse struct {
|
||||||
|
Hostname *string `protobuf:"bytes,1,req,name=hostname" json:"hostname,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetHostnameResponse) Reset() { *m = GetHostnameResponse{} }
|
||||||
|
func (m *GetHostnameResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetHostnameResponse) ProtoMessage() {}
|
||||||
|
func (*GetHostnameResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{16}
|
||||||
|
}
|
||||||
|
func (m *GetHostnameResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetHostnameResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetHostnameResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetHostnameResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetHostnameResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetHostnameResponse.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetHostnameResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetHostnameResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetHostnameResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetHostnameResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetHostnameResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetHostnameResponse) GetHostname() string {
|
||||||
|
if m != nil && m.Hostname != nil {
|
||||||
|
return *m.Hostname
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*ModulesServiceError)(nil), "appengine.ModulesServiceError")
|
||||||
|
proto.RegisterType((*GetModulesRequest)(nil), "appengine.GetModulesRequest")
|
||||||
|
proto.RegisterType((*GetModulesResponse)(nil), "appengine.GetModulesResponse")
|
||||||
|
proto.RegisterType((*GetVersionsRequest)(nil), "appengine.GetVersionsRequest")
|
||||||
|
proto.RegisterType((*GetVersionsResponse)(nil), "appengine.GetVersionsResponse")
|
||||||
|
proto.RegisterType((*GetDefaultVersionRequest)(nil), "appengine.GetDefaultVersionRequest")
|
||||||
|
proto.RegisterType((*GetDefaultVersionResponse)(nil), "appengine.GetDefaultVersionResponse")
|
||||||
|
proto.RegisterType((*GetNumInstancesRequest)(nil), "appengine.GetNumInstancesRequest")
|
||||||
|
proto.RegisterType((*GetNumInstancesResponse)(nil), "appengine.GetNumInstancesResponse")
|
||||||
|
proto.RegisterType((*SetNumInstancesRequest)(nil), "appengine.SetNumInstancesRequest")
|
||||||
|
proto.RegisterType((*SetNumInstancesResponse)(nil), "appengine.SetNumInstancesResponse")
|
||||||
|
proto.RegisterType((*StartModuleRequest)(nil), "appengine.StartModuleRequest")
|
||||||
|
proto.RegisterType((*StartModuleResponse)(nil), "appengine.StartModuleResponse")
|
||||||
|
proto.RegisterType((*StopModuleRequest)(nil), "appengine.StopModuleRequest")
|
||||||
|
proto.RegisterType((*StopModuleResponse)(nil), "appengine.StopModuleResponse")
|
||||||
|
proto.RegisterType((*GetHostnameRequest)(nil), "appengine.GetHostnameRequest")
|
||||||
|
proto.RegisterType((*GetHostnameResponse)(nil), "appengine.GetHostnameResponse")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterFile("google.golang.org/appengine/internal/modules/modules_service.proto", fileDescriptor_modules_service_9cd3bffe4e91c59a)
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileDescriptor_modules_service_9cd3bffe4e91c59a = []byte{
|
||||||
|
// 457 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0xc1, 0x6f, 0xd3, 0x30,
|
||||||
|
0x14, 0xc6, 0x69, 0x02, 0xdb, 0xf2, 0x0e, 0x90, 0x3a, 0x5b, 0xd7, 0x4d, 0x1c, 0x50, 0x4e, 0x1c,
|
||||||
|
0x50, 0x2b, 0x90, 0x10, 0xe7, 0xae, 0x35, 0x25, 0xb0, 0xa5, 0x28, 0xce, 0x2a, 0xc4, 0xa5, 0x0a,
|
||||||
|
0xdb, 0x23, 0x8b, 0x94, 0xda, 0xc1, 0x76, 0x77, 0xe4, 0xbf, 0xe0, 0xff, 0x45, 0x4b, 0xed, 0xb6,
|
||||||
|
0x81, 0x4e, 0x45, 0x68, 0xa7, 0xe4, 0x7d, 0xfe, 0xfc, 0x7b, 0x9f, 0x5f, 0xac, 0xc0, 0x59, 0x2e,
|
||||||
|
0x44, 0x5e, 0x62, 0x2f, 0x17, 0x65, 0xc6, 0xf3, 0x9e, 0x90, 0x79, 0x3f, 0xab, 0x2a, 0xe4, 0x79,
|
||||||
|
0xc1, 0xb1, 0x5f, 0x70, 0x8d, 0x92, 0x67, 0x65, 0x7f, 0x2e, 0xae, 0x17, 0x25, 0x2a, 0xfb, 0x9c,
|
||||||
|
0x29, 0x94, 0xb7, 0xc5, 0x15, 0xf6, 0x2a, 0x29, 0xb4, 0x20, 0xde, 0x6a, 0x47, 0xf8, 0xab, 0x05,
|
||||||
|
0xc1, 0xc5, 0xd2, 0xc4, 0x96, 0x1e, 0x2a, 0xa5, 0x90, 0xe1, 0x4f, 0xf0, 0xea, 0x97, 0xa1, 0xb8,
|
||||||
|
0x46, 0xb2, 0x07, 0xce, 0xe4, 0x93, 0xff, 0x88, 0x10, 0x78, 0x1a, 0xc5, 0xd3, 0xc1, 0x79, 0x34,
|
||||||
|
0x9a, 0x5d, 0x4c, 0x46, 0x97, 0xe7, 0xd4, 0x6f, 0x91, 0x00, 0x9e, 0x59, 0x6d, 0x4a, 0x13, 0x16,
|
||||||
|
0x4d, 0x62, 0xdf, 0x21, 0x47, 0xd0, 0xb6, 0x62, 0x14, 0xb3, 0x74, 0x10, 0x0f, 0x29, 0xf3, 0xdd,
|
||||||
|
0x3b, 0x6f, 0x9a, 0x0c, 0x62, 0x16, 0xd1, 0x38, 0x9d, 0xd1, 0x24, 0x99, 0x24, 0xfe, 0x63, 0x72,
|
||||||
|
0x08, 0xfe, 0x65, 0x4c, 0xbf, 0x7c, 0xa6, 0xc3, 0x94, 0x8e, 0x66, 0x2c, 0x1d, 0xa4, 0xd4, 0x7f,
|
||||||
|
0x12, 0x06, 0xd0, 0x1e, 0xa3, 0x36, 0xc9, 0x12, 0xfc, 0xb1, 0x40, 0xa5, 0xc3, 0x57, 0x40, 0x36,
|
||||||
|
0x45, 0x55, 0x09, 0xae, 0x90, 0x74, 0x60, 0x6f, 0x79, 0xcc, 0x6e, 0xeb, 0x85, 0xfb, 0xd2, 0x4b,
|
||||||
|
0x4c, 0x65, 0xdc, 0x53, 0x94, 0xaa, 0x10, 0xdc, 0x32, 0x1a, 0xee, 0xd6, 0x86, 0xbb, 0x0f, 0x41,
|
||||||
|
0xc3, 0x6d, 0xe0, 0x5d, 0xd8, 0xbf, 0x5d, 0x6a, 0x86, 0x6e, 0xcb, 0xf0, 0x0d, 0x74, 0xc7, 0xa8,
|
||||||
|
0x47, 0xf8, 0x3d, 0x5b, 0x94, 0x76, 0xdf, 0xae, 0x26, 0x6f, 0xe1, 0x64, 0xcb, 0x9e, 0x6d, 0xad,
|
||||||
|
0x9c, 0xcd, 0x56, 0x1f, 0xa1, 0x33, 0x46, 0x1d, 0x2f, 0xe6, 0x11, 0x57, 0x3a, 0xe3, 0x57, 0xb8,
|
||||||
|
0xeb, 0x34, 0x9b, 0x2c, 0xa7, 0x5e, 0x58, 0xb1, 0xde, 0xc1, 0xf1, 0x5f, 0x2c, 0x13, 0xe0, 0x39,
|
||||||
|
0x78, 0x85, 0x15, 0xeb, 0x08, 0x6e, 0xb2, 0x16, 0xc2, 0x1b, 0xe8, 0xb0, 0x07, 0x0a, 0xd1, 0xec,
|
||||||
|
0xe4, 0xfe, 0xd9, 0xe9, 0x04, 0x8e, 0xd9, 0xf6, 0x88, 0xe1, 0x7b, 0x20, 0x4c, 0x67, 0xd2, 0xdc,
|
||||||
|
0x81, 0x6d, 0x01, 0x9c, 0xfb, 0x02, 0x34, 0x26, 0x7a, 0x04, 0x41, 0x83, 0x63, 0xf0, 0x14, 0xda,
|
||||||
|
0x4c, 0x8b, 0xea, 0x7e, 0xfa, 0xbf, 0xcd, 0xf8, 0xf0, 0x2e, 0xe5, 0x1a, 0x63, 0xe0, 0xdf, 0xea,
|
||||||
|
0xfb, 0xf8, 0x41, 0x28, 0xcd, 0xb3, 0xf9, 0xff, 0xd3, 0xc9, 0x29, 0x1c, 0xd8, 0x59, 0x75, 0xdd,
|
||||||
|
0x7a, 0x69, 0x55, 0x87, 0xaf, 0xeb, 0x5b, 0xbc, 0xee, 0x61, 0xbe, 0xec, 0x29, 0x1c, 0xdc, 0x18,
|
||||||
|
0xcd, 0x8c, 0x68, 0x55, 0x9f, 0x79, 0x5f, 0xf7, 0xcd, 0x5f, 0xe2, 0x77, 0x00, 0x00, 0x00, 0xff,
|
||||||
|
0xff, 0x6e, 0xbc, 0xe0, 0x61, 0x5c, 0x04, 0x00, 0x00,
|
||||||
|
}
|
80
vendor/google.golang.org/appengine/internal/modules/modules_service.proto
generated
vendored
Normal file
80
vendor/google.golang.org/appengine/internal/modules/modules_service.proto
generated
vendored
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
syntax = "proto2";
|
||||||
|
option go_package = "modules";
|
||||||
|
|
||||||
|
package appengine;
|
||||||
|
|
||||||
|
message ModulesServiceError {
|
||||||
|
enum ErrorCode {
|
||||||
|
OK = 0;
|
||||||
|
INVALID_MODULE = 1;
|
||||||
|
INVALID_VERSION = 2;
|
||||||
|
INVALID_INSTANCES = 3;
|
||||||
|
TRANSIENT_ERROR = 4;
|
||||||
|
UNEXPECTED_STATE = 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetModulesRequest {
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetModulesResponse {
|
||||||
|
repeated string module = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetVersionsRequest {
|
||||||
|
optional string module = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetVersionsResponse {
|
||||||
|
repeated string version = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetDefaultVersionRequest {
|
||||||
|
optional string module = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetDefaultVersionResponse {
|
||||||
|
required string version = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetNumInstancesRequest {
|
||||||
|
optional string module = 1;
|
||||||
|
optional string version = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetNumInstancesResponse {
|
||||||
|
required int64 instances = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SetNumInstancesRequest {
|
||||||
|
optional string module = 1;
|
||||||
|
optional string version = 2;
|
||||||
|
required int64 instances = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SetNumInstancesResponse {}
|
||||||
|
|
||||||
|
message StartModuleRequest {
|
||||||
|
required string module = 1;
|
||||||
|
required string version = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message StartModuleResponse {}
|
||||||
|
|
||||||
|
message StopModuleRequest {
|
||||||
|
optional string module = 1;
|
||||||
|
optional string version = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message StopModuleResponse {}
|
||||||
|
|
||||||
|
message GetHostnameRequest {
|
||||||
|
optional string module = 1;
|
||||||
|
optional string version = 2;
|
||||||
|
optional string instance = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetHostnameResponse {
|
||||||
|
required string hostname = 1;
|
||||||
|
}
|
||||||
|
|
25
vendor/google.golang.org/appengine/namespace.go
generated
vendored
Normal file
25
vendor/google.golang.org/appengine/namespace.go
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// Copyright 2012 Google Inc. All rights reserved.
|
||||||
|
// Use of this source code is governed by the Apache 2.0
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package appengine
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
|
"google.golang.org/appengine/internal"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Namespace returns a replacement context that operates within the given namespace.
|
||||||
|
func Namespace(c context.Context, namespace string) (context.Context, error) {
|
||||||
|
if !validNamespace.MatchString(namespace) {
|
||||||
|
return nil, fmt.Errorf("appengine: namespace %q does not match /%s/", namespace, validNamespace)
|
||||||
|
}
|
||||||
|
return internal.NamespacedContext(c, namespace), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// validNamespace matches valid namespace names.
|
||||||
|
var validNamespace = regexp.MustCompile(`^[0-9A-Za-z._-]{0,100}$`)
|
20
vendor/google.golang.org/appengine/timeout.go
generated
vendored
Normal file
20
vendor/google.golang.org/appengine/timeout.go
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
// Copyright 2013 Google Inc. All rights reserved.
|
||||||
|
// Use of this source code is governed by the Apache 2.0
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package appengine
|
||||||
|
|
||||||
|
import "golang.org/x/net/context"
|
||||||
|
|
||||||
|
// IsTimeoutError reports whether err is a timeout error.
|
||||||
|
func IsTimeoutError(err error) bool {
|
||||||
|
if err == context.DeadlineExceeded {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if t, ok := err.(interface {
|
||||||
|
IsTimeout() bool
|
||||||
|
}); ok {
|
||||||
|
return t.IsTimeout()
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
18
vendor/google.golang.org/appengine/travis_install.sh
generated
vendored
Normal file
18
vendor/google.golang.org/appengine/travis_install.sh
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [[ $GO111MODULE == "on" ]]; then
|
||||||
|
go get .
|
||||||
|
else
|
||||||
|
go get -u -v $(go list -f '{{join .Imports "\n"}}{{"\n"}}{{join .TestImports "\n"}}' ./... | sort | uniq | grep -v appengine)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $GOAPP == "true" ]]; then
|
||||||
|
mkdir /tmp/sdk
|
||||||
|
curl -o /tmp/sdk.zip "https://storage.googleapis.com/appengine-sdks/featured/go_appengine_sdk_linux_amd64-1.9.68.zip"
|
||||||
|
unzip -q /tmp/sdk.zip -d /tmp/sdk
|
||||||
|
# NOTE: Set the following env vars in the test script:
|
||||||
|
# export PATH="$PATH:/tmp/sdk/go_appengine"
|
||||||
|
# export APPENGINE_DEV_APPSERVER=/tmp/sdk/go_appengine/dev_appserver.py
|
||||||
|
fi
|
||||||
|
|
12
vendor/google.golang.org/appengine/travis_test.sh
generated
vendored
Normal file
12
vendor/google.golang.org/appengine/travis_test.sh
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
go version
|
||||||
|
go test -v google.golang.org/appengine/...
|
||||||
|
go test -v -race google.golang.org/appengine/...
|
||||||
|
if [[ $GOAPP == "true" ]]; then
|
||||||
|
export PATH="$PATH:/tmp/sdk/go_appengine"
|
||||||
|
export APPENGINE_DEV_APPSERVER=/tmp/sdk/go_appengine/dev_appserver.py
|
||||||
|
goapp version
|
||||||
|
goapp test -v google.golang.org/appengine/...
|
||||||
|
fi
|
9
vendor/modules.txt
vendored
9
vendor/modules.txt
vendored
|
@ -1,5 +1,6 @@
|
||||||
# cloud.google.com/go v0.45.0
|
# cloud.google.com/go v0.45.0
|
||||||
cloud.google.com/go/civil
|
cloud.google.com/go/civil
|
||||||
|
cloud.google.com/go/compute/metadata
|
||||||
# gitea.com/macaron/binding v0.0.0-20190822013154-a5f53841ed2b
|
# gitea.com/macaron/binding v0.0.0-20190822013154-a5f53841ed2b
|
||||||
gitea.com/macaron/binding
|
gitea.com/macaron/binding
|
||||||
# gitea.com/macaron/cache v0.0.0-20190822004001-a6e7fee4ee76
|
# gitea.com/macaron/cache v0.0.0-20190822004001-a6e7fee4ee76
|
||||||
|
@ -313,7 +314,7 @@ github.com/markbates/goth/providers/facebook
|
||||||
github.com/markbates/goth/providers/gitea
|
github.com/markbates/goth/providers/gitea
|
||||||
github.com/markbates/goth/providers/github
|
github.com/markbates/goth/providers/github
|
||||||
github.com/markbates/goth/providers/gitlab
|
github.com/markbates/goth/providers/gitlab
|
||||||
github.com/markbates/goth/providers/gplus
|
github.com/markbates/goth/providers/google
|
||||||
github.com/markbates/goth/providers/openidConnect
|
github.com/markbates/goth/providers/openidConnect
|
||||||
github.com/markbates/goth/providers/twitter
|
github.com/markbates/goth/providers/twitter
|
||||||
# github.com/mattn/go-isatty v0.0.7
|
# github.com/mattn/go-isatty v0.0.7
|
||||||
|
@ -481,7 +482,10 @@ golang.org/x/net/internal/socks
|
||||||
golang.org/x/net/proxy
|
golang.org/x/net/proxy
|
||||||
# golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
|
# golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
|
||||||
golang.org/x/oauth2
|
golang.org/x/oauth2
|
||||||
|
golang.org/x/oauth2/google
|
||||||
golang.org/x/oauth2/internal
|
golang.org/x/oauth2/internal
|
||||||
|
golang.org/x/oauth2/jws
|
||||||
|
golang.org/x/oauth2/jwt
|
||||||
# golang.org/x/sys v0.0.0-20190910064555-bbd175535a8b
|
# golang.org/x/sys v0.0.0-20190910064555-bbd175535a8b
|
||||||
golang.org/x/sys/cpu
|
golang.org/x/sys/cpu
|
||||||
golang.org/x/sys/unix
|
golang.org/x/sys/unix
|
||||||
|
@ -525,11 +529,14 @@ golang.org/x/tools/internal/imports
|
||||||
golang.org/x/tools/internal/module
|
golang.org/x/tools/internal/module
|
||||||
golang.org/x/tools/internal/semver
|
golang.org/x/tools/internal/semver
|
||||||
# google.golang.org/appengine v1.6.2
|
# google.golang.org/appengine v1.6.2
|
||||||
|
google.golang.org/appengine
|
||||||
google.golang.org/appengine/cloudsql
|
google.golang.org/appengine/cloudsql
|
||||||
google.golang.org/appengine/internal
|
google.golang.org/appengine/internal
|
||||||
|
google.golang.org/appengine/internal/app_identity
|
||||||
google.golang.org/appengine/internal/base
|
google.golang.org/appengine/internal/base
|
||||||
google.golang.org/appengine/internal/datastore
|
google.golang.org/appengine/internal/datastore
|
||||||
google.golang.org/appengine/internal/log
|
google.golang.org/appengine/internal/log
|
||||||
|
google.golang.org/appengine/internal/modules
|
||||||
google.golang.org/appengine/internal/remote_api
|
google.golang.org/appengine/internal/remote_api
|
||||||
google.golang.org/appengine/internal/urlfetch
|
google.golang.org/appengine/internal/urlfetch
|
||||||
google.golang.org/appengine/urlfetch
|
google.golang.org/appengine/urlfetch
|
||||||
|
|
Loading…
Reference in a new issue