Merge pull request #29475 from AkihiroSuda/vendor-oauth2-3
Vendor gcplogs deps
This commit is contained in:
commit
b0aab6e83e
122 changed files with 17624 additions and 7342 deletions
|
@ -8,10 +8,10 @@ import (
|
|||
|
||||
"github.com/docker/docker/daemon/logger"
|
||||
|
||||
"cloud.google.com/go/compute/metadata"
|
||||
"cloud.google.com/go/logging"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/cloud/compute/metadata"
|
||||
"google.golang.org/cloud/logging"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -51,7 +51,7 @@ func init() {
|
|||
}
|
||||
|
||||
type gcplogs struct {
|
||||
client *logging.Client
|
||||
logger *logging.Logger
|
||||
instance *instanceInfo
|
||||
container *containerInfo
|
||||
}
|
||||
|
@ -114,17 +114,18 @@ func New(ctx logger.Context) (logger.Logger, error) {
|
|||
return nil, fmt.Errorf("No project was specified and couldn't read project from the meatadata server. Please specify a project")
|
||||
}
|
||||
|
||||
c, err := logging.NewClient(context.Background(), project, "gcplogs-docker-driver")
|
||||
c, err := logging.NewClient(context.Background(), project)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
lg := c.Logger("gcplogs-docker-driver")
|
||||
|
||||
if err := c.Ping(); err != nil {
|
||||
if err := c.Ping(context.Background()); err != nil {
|
||||
return nil, fmt.Errorf("unable to connect or authenticate with Google Cloud Logging: %v", err)
|
||||
}
|
||||
|
||||
l := &gcplogs{
|
||||
client: c,
|
||||
logger: lg,
|
||||
container: &containerInfo{
|
||||
Name: ctx.ContainerName,
|
||||
ID: ctx.ContainerID,
|
||||
|
@ -157,11 +158,14 @@ func New(ctx logger.Context) (logger.Logger, error) {
|
|||
// overflow func is called. We want to surface the error to the user
|
||||
// without overly spamming /var/log/docker.log so we log the first time
|
||||
// we overflow and every 1000th time after.
|
||||
c.Overflow = func(_ *logging.Client, _ logging.Entry) error {
|
||||
if i := atomic.AddUint64(&droppedLogs, 1); i%1000 == 1 {
|
||||
logrus.Errorf("gcplogs driver has dropped %v logs", i)
|
||||
c.OnError = func(err error) {
|
||||
if err == logging.ErrOverflow {
|
||||
if i := atomic.AddUint64(&droppedLogs, 1); i%1000 == 1 {
|
||||
logrus.Errorf("gcplogs driver has dropped %v logs", i)
|
||||
}
|
||||
} else {
|
||||
logrus.Error(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
return l, nil
|
||||
|
@ -181,18 +185,20 @@ func ValidateLogOpts(cfg map[string]string) error {
|
|||
}
|
||||
|
||||
func (l *gcplogs) Log(m *logger.Message) error {
|
||||
return l.client.Log(logging.Entry{
|
||||
Time: m.Timestamp,
|
||||
l.logger.Log(logging.Entry{
|
||||
Timestamp: m.Timestamp,
|
||||
Payload: &dockerLogEntry{
|
||||
Instance: l.instance,
|
||||
Container: l.container,
|
||||
Data: string(m.Line),
|
||||
},
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *gcplogs) Close() error {
|
||||
return l.client.Flush()
|
||||
l.logger.Flush()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *gcplogs) Name() string {
|
||||
|
|
|
@ -88,9 +88,11 @@ github.com/jmespath/go-jmespath 0b12d6b521d83fc7f755e7cfc1b1fbdd35a01a74
|
|||
github.com/bsphere/le_go d3308aafe090956bc89a65f0769f58251a1b4f03
|
||||
|
||||
# gcplogs deps
|
||||
golang.org/x/oauth2 2baa8a1b9338cf13d9eeb27696d761155fa480be
|
||||
google.golang.org/api dc6d2353af16e2a2b0ff6986af051d473a4ed468
|
||||
google.golang.org/cloud dae7e3d993bc3812a2185af60552bb6b847e52a0
|
||||
golang.org/x/oauth2 96382aa079b72d8c014eb0c50f6c223d1e6a2de0
|
||||
google.golang.org/api 3cc2e591b550923a2c5f0ab5a803feda924d5823
|
||||
cloud.google.com/go 9d965e63e8cceb1b5d7977a202f0fcb8866d6525
|
||||
github.com/googleapis/gax-go da06d194a00e19ce00d9011a13931c3f6f6887c7
|
||||
google.golang.org/genproto 9359a8d303c45e3212571b77610f1cefb0c6f3eb
|
||||
|
||||
# native credentials
|
||||
github.com/docker/docker-credential-helpers f72c04f1d8e71959a6d103f808c50ccbad79b9fd
|
||||
|
|
0
vendor/google.golang.org/cloud/LICENSE → vendor/cloud.google.com/go/LICENSE
generated
vendored
0
vendor/google.golang.org/cloud/LICENSE → vendor/cloud.google.com/go/LICENSE
generated
vendored
|
@ -17,7 +17,7 @@
|
|||
//
|
||||
// This package is a wrapper around the GCE metadata service,
|
||||
// as documented at https://developers.google.com/compute/docs/metadata.
|
||||
package metadata // import "google.golang.org/cloud/compute/metadata"
|
||||
package metadata // import "cloud.google.com/go/compute/metadata"
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
@ -27,11 +27,27 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"google.golang.org/cloud/internal"
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/net/context/ctxhttp"
|
||||
|
||||
"cloud.google.com/go/internal"
|
||||
)
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
type cachedValue struct {
|
||||
|
@ -47,17 +63,29 @@ var (
|
|||
instID = &cachedValue{k: "instance/id", trim: true}
|
||||
)
|
||||
|
||||
var metaClient = &http.Client{
|
||||
Transport: &internal.Transport{
|
||||
Base: &http.Transport{
|
||||
Dial: (&net.Dialer{
|
||||
Timeout: 750 * time.Millisecond,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}).Dial,
|
||||
ResponseHeaderTimeout: 750 * time.Millisecond,
|
||||
var (
|
||||
metaClient = &http.Client{
|
||||
Transport: &internal.Transport{
|
||||
Base: &http.Transport{
|
||||
Dial: (&net.Dialer{
|
||||
Timeout: 2 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}).Dial,
|
||||
ResponseHeaderTimeout: 2 * time.Second,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
subscribeClient = &http.Client{
|
||||
Transport: &internal.Transport{
|
||||
Base: &http.Transport{
|
||||
Dial: (&net.Dialer{
|
||||
Timeout: 2 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}).Dial,
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
// NotDefinedError is returned when requested metadata is not defined.
|
||||
//
|
||||
|
@ -80,31 +108,31 @@ func (suffix NotDefinedError) Error() string {
|
|||
// If the requested metadata is not defined, the returned error will
|
||||
// be of type NotDefinedError.
|
||||
func Get(suffix string) (string, error) {
|
||||
val, _, err := getETag(suffix)
|
||||
val, _, err := getETag(metaClient, suffix)
|
||||
return val, err
|
||||
}
|
||||
|
||||
// getETag returns a value from the metadata service as well as the associated
|
||||
// ETag. This func is otherwise equivalent to Get.
|
||||
func getETag(suffix string) (value, etag string, err error) {
|
||||
// ETag using the provided client. This func is otherwise equivalent to Get.
|
||||
func getETag(client *http.Client, 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("GCE_METADATA_HOST")
|
||||
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 = "169.254.169.254"
|
||||
host = metadataIP
|
||||
}
|
||||
url := "http://" + host + "/computeMetadata/v1/" + suffix
|
||||
req, _ := http.NewRequest("GET", url, nil)
|
||||
req.Header.Set("Metadata-Flavor", "Google")
|
||||
res, err := metaClient.Do(req)
|
||||
res, err := client.Do(req)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
|
@ -145,33 +173,103 @@ func (c *cachedValue) get() (v string, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
var onGCE struct {
|
||||
sync.Mutex
|
||||
set bool
|
||||
v bool
|
||||
}
|
||||
var (
|
||||
onGCEOnce sync.Once
|
||||
onGCE bool
|
||||
)
|
||||
|
||||
// OnGCE reports whether this process is running on Google Compute Engine.
|
||||
func OnGCE() bool {
|
||||
defer onGCE.Unlock()
|
||||
onGCE.Lock()
|
||||
if onGCE.set {
|
||||
return onGCE.v
|
||||
}
|
||||
onGCE.set = true
|
||||
onGCEOnce.Do(initOnGCE)
|
||||
return onGCE
|
||||
}
|
||||
|
||||
// We use the DNS name of the metadata service here instead of the IP address
|
||||
// because we expect that to fail faster in the not-on-GCE case.
|
||||
res, err := metaClient.Get("http://metadata.google.internal")
|
||||
if err != nil {
|
||||
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/GoogleCloudPlatform/google-cloud-go/issues/194
|
||||
go func() {
|
||||
res, err := ctxhttp.Get(ctx, metaClient, "http://"+metadataIP)
|
||||
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
|
||||
}
|
||||
onGCE.v = res.Header.Get("Metadata-Flavor") == "Google"
|
||||
return onGCE.v
|
||||
slurp, _ := ioutil.ReadFile("/sys/class/dmi/id/product_name")
|
||||
name := strings.TrimSpace(string(slurp))
|
||||
return name == "Google" || name == "Google Compute Engine"
|
||||
}
|
||||
|
||||
// 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
|
||||
|
@ -182,7 +280,7 @@ func 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 := getETag(suffix)
|
||||
val, lastETag, err := getETag(subscribeClient, suffix)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -192,9 +290,13 @@ func Subscribe(suffix string, fn func(v string, ok bool) error) error {
|
|||
}
|
||||
|
||||
ok := true
|
||||
suffix += "?wait_for_change=true&last_etag="
|
||||
if strings.ContainsRune(suffix, '?') {
|
||||
suffix += "&wait_for_change=true&last_etag="
|
||||
} else {
|
||||
suffix += "?wait_for_change=true&last_etag="
|
||||
}
|
||||
for {
|
||||
val, etag, err := getETag(suffix + url.QueryEscape(lastETag))
|
||||
val, etag, err := getETag(subscribeClient, suffix+url.QueryEscape(lastETag))
|
||||
if err != nil {
|
||||
if _, deleted := err.(NotDefinedError); !deleted {
|
||||
time.Sleep(failedSubscribeSleep)
|
||||
|
@ -325,3 +427,12 @@ func Scopes(serviceAccount string) ([]string, error) {
|
|||
}
|
||||
return lines("instance/service-accounts/" + serviceAccount + "/scopes")
|
||||
}
|
||||
|
||||
func strsContains(ss []string, s string) bool {
|
||||
for _, v := range ss {
|
||||
if v == s {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
64
vendor/cloud.google.com/go/internal/cloud.go
generated
vendored
Normal file
64
vendor/cloud.google.com/go/internal/cloud.go
generated
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
// Copyright 2014 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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 internal provides support for the cloud packages.
|
||||
//
|
||||
// Users should not import this package directly.
|
||||
package internal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
const userAgent = "gcloud-golang/0.1"
|
||||
|
||||
// Transport is an http.RoundTripper that appends Google Cloud client's
|
||||
// user-agent to the original request's user-agent header.
|
||||
type Transport struct {
|
||||
// TODO(bradfitz): delete internal.Transport. It's too wrappy for what it does.
|
||||
// Do User-Agent some other way.
|
||||
|
||||
// Base is the actual http.RoundTripper
|
||||
// requests will use. It must not be nil.
|
||||
Base http.RoundTripper
|
||||
}
|
||||
|
||||
// RoundTrip appends a user-agent to the existing user-agent
|
||||
// header and delegates the request to the base http.RoundTripper.
|
||||
func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
req = cloneRequest(req)
|
||||
ua := req.Header.Get("User-Agent")
|
||||
if ua == "" {
|
||||
ua = userAgent
|
||||
} else {
|
||||
ua = fmt.Sprintf("%s %s", ua, userAgent)
|
||||
}
|
||||
req.Header.Set("User-Agent", ua)
|
||||
return t.Base.RoundTrip(req)
|
||||
}
|
||||
|
||||
// cloneRequest returns a clone of the provided *http.Request.
|
||||
// The clone is a shallow copy of the struct and its Header map.
|
||||
func cloneRequest(r *http.Request) *http.Request {
|
||||
// shallow copy of the struct
|
||||
r2 := new(http.Request)
|
||||
*r2 = *r
|
||||
// deep copy of the Header
|
||||
r2.Header = make(http.Header)
|
||||
for k, s := range r.Header {
|
||||
r2.Header[k] = s
|
||||
}
|
||||
return r2
|
||||
}
|
55
vendor/cloud.google.com/go/internal/retry.go
generated
vendored
Normal file
55
vendor/cloud.google.com/go/internal/retry.go
generated
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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 internal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
gax "github.com/googleapis/gax-go"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// Retry calls the supplied function f repeatedly according to the provided
|
||||
// backoff parameters. It returns when one of the following occurs:
|
||||
// When f's first return value is true, Retry immediately returns with f's second
|
||||
// return value.
|
||||
// When the provided context is done, Retry returns with ctx.Err().
|
||||
func Retry(ctx context.Context, bo gax.Backoff, f func() (stop bool, err error)) error {
|
||||
return retry(ctx, bo, f, gax.Sleep)
|
||||
}
|
||||
|
||||
func retry(ctx context.Context, bo gax.Backoff, f func() (stop bool, err error),
|
||||
sleep func(context.Context, time.Duration) error) error {
|
||||
var lastErr error
|
||||
for {
|
||||
stop, err := f()
|
||||
if stop {
|
||||
return err
|
||||
}
|
||||
// Remember the last "real" error from f.
|
||||
if err != nil && err != context.Canceled && err != context.DeadlineExceeded {
|
||||
lastErr = err
|
||||
}
|
||||
p := bo.Pause()
|
||||
if cerr := sleep(ctx, p); cerr != nil {
|
||||
if lastErr != nil {
|
||||
return fmt.Errorf("%v; last function err: %v", cerr, lastErr)
|
||||
}
|
||||
return cerr
|
||||
}
|
||||
}
|
||||
}
|
300
vendor/cloud.google.com/go/logging/apiv2/config_client.go
generated
vendored
Normal file
300
vendor/cloud.google.com/go/logging/apiv2/config_client.go
generated
vendored
Normal file
|
@ -0,0 +1,300 @@
|
|||
// Copyright 2016, Google Inc. All rights reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// AUTO-GENERATED CODE. DO NOT EDIT.
|
||||
|
||||
package logging
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
gax "github.com/googleapis/gax-go"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/api/iterator"
|
||||
"google.golang.org/api/option"
|
||||
"google.golang.org/api/transport"
|
||||
loggingpb "google.golang.org/genproto/googleapis/logging/v2"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
var (
|
||||
configParentPathTemplate = gax.MustCompilePathTemplate("projects/{project}")
|
||||
configSinkPathTemplate = gax.MustCompilePathTemplate("projects/{project}/sinks/{sink}")
|
||||
)
|
||||
|
||||
// ConfigCallOptions contains the retry settings for each method of ConfigClient.
|
||||
type ConfigCallOptions struct {
|
||||
ListSinks []gax.CallOption
|
||||
GetSink []gax.CallOption
|
||||
CreateSink []gax.CallOption
|
||||
UpdateSink []gax.CallOption
|
||||
DeleteSink []gax.CallOption
|
||||
}
|
||||
|
||||
func defaultConfigClientOptions() []option.ClientOption {
|
||||
return []option.ClientOption{
|
||||
option.WithEndpoint("logging.googleapis.com:443"),
|
||||
option.WithScopes(
|
||||
"https://www.googleapis.com/auth/cloud-platform",
|
||||
"https://www.googleapis.com/auth/cloud-platform.read-only",
|
||||
"https://www.googleapis.com/auth/logging.admin",
|
||||
"https://www.googleapis.com/auth/logging.read",
|
||||
"https://www.googleapis.com/auth/logging.write",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func defaultConfigCallOptions() *ConfigCallOptions {
|
||||
retry := map[[2]string][]gax.CallOption{
|
||||
{"default", "idempotent"}: {
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnCodes([]codes.Code{
|
||||
codes.DeadlineExceeded,
|
||||
codes.Unavailable,
|
||||
}, gax.Backoff{
|
||||
Initial: 100 * time.Millisecond,
|
||||
Max: 1000 * time.Millisecond,
|
||||
Multiplier: 1.2,
|
||||
})
|
||||
}),
|
||||
},
|
||||
}
|
||||
return &ConfigCallOptions{
|
||||
ListSinks: retry[[2]string{"default", "idempotent"}],
|
||||
GetSink: retry[[2]string{"default", "idempotent"}],
|
||||
CreateSink: retry[[2]string{"default", "non_idempotent"}],
|
||||
UpdateSink: retry[[2]string{"default", "non_idempotent"}],
|
||||
DeleteSink: retry[[2]string{"default", "idempotent"}],
|
||||
}
|
||||
}
|
||||
|
||||
// ConfigClient is a client for interacting with Stackdriver Logging API.
|
||||
type ConfigClient struct {
|
||||
// The connection to the service.
|
||||
conn *grpc.ClientConn
|
||||
|
||||
// The gRPC API client.
|
||||
configClient loggingpb.ConfigServiceV2Client
|
||||
|
||||
// The call options for this service.
|
||||
CallOptions *ConfigCallOptions
|
||||
|
||||
// The metadata to be sent with each request.
|
||||
metadata metadata.MD
|
||||
}
|
||||
|
||||
// NewConfigClient creates a new config service v2 client.
|
||||
//
|
||||
// Service for configuring sinks used to export log entries outside of
|
||||
// Stackdriver Logging.
|
||||
func NewConfigClient(ctx context.Context, opts ...option.ClientOption) (*ConfigClient, error) {
|
||||
conn, err := transport.DialGRPC(ctx, append(defaultConfigClientOptions(), opts...)...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c := &ConfigClient{
|
||||
conn: conn,
|
||||
CallOptions: defaultConfigCallOptions(),
|
||||
|
||||
configClient: loggingpb.NewConfigServiceV2Client(conn),
|
||||
}
|
||||
c.SetGoogleClientInfo("gax", gax.Version)
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// Connection returns the client's connection to the API service.
|
||||
func (c *ConfigClient) Connection() *grpc.ClientConn {
|
||||
return c.conn
|
||||
}
|
||||
|
||||
// Close closes the connection to the API service. The user should invoke this when
|
||||
// the client is no longer required.
|
||||
func (c *ConfigClient) Close() error {
|
||||
return c.conn.Close()
|
||||
}
|
||||
|
||||
// SetGoogleClientInfo sets the name and version of the application in
|
||||
// the `x-goog-api-client` header passed on each request. Intended for
|
||||
// use by Google-written clients.
|
||||
func (c *ConfigClient) SetGoogleClientInfo(name, version string) {
|
||||
goVersion := strings.Replace(runtime.Version(), " ", "_", -1)
|
||||
v := fmt.Sprintf("%s/%s %s gax/%s go/%s", name, version, gapicNameVersion, gax.Version, goVersion)
|
||||
c.metadata = metadata.Pairs("x-goog-api-client", v)
|
||||
}
|
||||
|
||||
// ConfigParentPath returns the path for the parent resource.
|
||||
func ConfigParentPath(project string) string {
|
||||
path, err := configParentPathTemplate.Render(map[string]string{
|
||||
"project": project,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
// ConfigSinkPath returns the path for the sink resource.
|
||||
func ConfigSinkPath(project, sink string) string {
|
||||
path, err := configSinkPathTemplate.Render(map[string]string{
|
||||
"project": project,
|
||||
"sink": sink,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
// ListSinks lists sinks.
|
||||
func (c *ConfigClient) ListSinks(ctx context.Context, req *loggingpb.ListSinksRequest) *LogSinkIterator {
|
||||
md, _ := metadata.FromContext(ctx)
|
||||
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
|
||||
it := &LogSinkIterator{}
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.LogSink, string, error) {
|
||||
var resp *loggingpb.ListSinksResponse
|
||||
req.PageToken = pageToken
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.configClient.ListSinks(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.ListSinks...)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return resp.Sinks, resp.NextPageToken, nil
|
||||
}
|
||||
fetch := func(pageSize int, pageToken string) (string, error) {
|
||||
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
it.items = append(it.items, items...)
|
||||
return nextPageToken, nil
|
||||
}
|
||||
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
|
||||
return it
|
||||
}
|
||||
|
||||
// GetSink gets a sink.
|
||||
func (c *ConfigClient) GetSink(ctx context.Context, req *loggingpb.GetSinkRequest) (*loggingpb.LogSink, error) {
|
||||
md, _ := metadata.FromContext(ctx)
|
||||
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
|
||||
var resp *loggingpb.LogSink
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.configClient.GetSink(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.GetSink...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// CreateSink creates a sink.
|
||||
func (c *ConfigClient) CreateSink(ctx context.Context, req *loggingpb.CreateSinkRequest) (*loggingpb.LogSink, error) {
|
||||
md, _ := metadata.FromContext(ctx)
|
||||
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
|
||||
var resp *loggingpb.LogSink
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.configClient.CreateSink(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.CreateSink...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// UpdateSink updates or creates a sink.
|
||||
func (c *ConfigClient) UpdateSink(ctx context.Context, req *loggingpb.UpdateSinkRequest) (*loggingpb.LogSink, error) {
|
||||
md, _ := metadata.FromContext(ctx)
|
||||
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
|
||||
var resp *loggingpb.LogSink
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.configClient.UpdateSink(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.UpdateSink...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// DeleteSink deletes a sink.
|
||||
func (c *ConfigClient) DeleteSink(ctx context.Context, req *loggingpb.DeleteSinkRequest) error {
|
||||
md, _ := metadata.FromContext(ctx)
|
||||
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
_, err = c.configClient.DeleteSink(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.DeleteSink...)
|
||||
return err
|
||||
}
|
||||
|
||||
// LogSinkIterator manages a stream of *loggingpb.LogSink.
|
||||
type LogSinkIterator struct {
|
||||
items []*loggingpb.LogSink
|
||||
pageInfo *iterator.PageInfo
|
||||
nextFunc func() error
|
||||
|
||||
// InternalFetch is for use by the Google Cloud Libraries only.
|
||||
// It is not part of the stable interface of this package.
|
||||
//
|
||||
// InternalFetch returns results from a single call to the underlying RPC.
|
||||
// The number of results is no greater than pageSize.
|
||||
// If there are no more results, nextPageToken is empty and err is nil.
|
||||
InternalFetch func(pageSize int, pageToken string) (results []*loggingpb.LogSink, nextPageToken string, err error)
|
||||
}
|
||||
|
||||
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
|
||||
func (it *LogSinkIterator) PageInfo() *iterator.PageInfo {
|
||||
return it.pageInfo
|
||||
}
|
||||
|
||||
// Next returns the next result. Its second return value is iterator.Done if there are no more
|
||||
// results. Once Next returns Done, all subsequent calls will return Done.
|
||||
func (it *LogSinkIterator) Next() (*loggingpb.LogSink, error) {
|
||||
var item *loggingpb.LogSink
|
||||
if err := it.nextFunc(); err != nil {
|
||||
return item, err
|
||||
}
|
||||
item = it.items[0]
|
||||
it.items = it.items[1:]
|
||||
return item, nil
|
||||
}
|
||||
|
||||
func (it *LogSinkIterator) bufLen() int {
|
||||
return len(it.items)
|
||||
}
|
||||
|
||||
func (it *LogSinkIterator) takeBuf() interface{} {
|
||||
b := it.items
|
||||
it.items = nil
|
||||
return b
|
||||
}
|
26
vendor/cloud.google.com/go/logging/apiv2/doc.go
generated
vendored
Normal file
26
vendor/cloud.google.com/go/logging/apiv2/doc.go
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Copyright 2016, Google Inc. All rights reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// AUTO-GENERATED CODE. DO NOT EDIT.
|
||||
|
||||
// Package logging is an experimental, auto-generated package for the
|
||||
// logging API.
|
||||
//
|
||||
// The Stackdriver Logging API lets you write log entries and manage your
|
||||
// logs, log sinks and logs-based metrics.
|
||||
//
|
||||
// Use the client at cloud.google.com/go/logging in preference to this.
|
||||
package logging // import "cloud.google.com/go/logging/apiv2"
|
||||
|
||||
const gapicNameVersion = "gapic/0.1.0"
|
359
vendor/cloud.google.com/go/logging/apiv2/logging_client.go
generated
vendored
Normal file
359
vendor/cloud.google.com/go/logging/apiv2/logging_client.go
generated
vendored
Normal file
|
@ -0,0 +1,359 @@
|
|||
// Copyright 2016, Google Inc. All rights reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// AUTO-GENERATED CODE. DO NOT EDIT.
|
||||
|
||||
package logging
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
gax "github.com/googleapis/gax-go"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/api/iterator"
|
||||
"google.golang.org/api/option"
|
||||
"google.golang.org/api/transport"
|
||||
monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
loggingpb "google.golang.org/genproto/googleapis/logging/v2"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
var (
|
||||
loggingParentPathTemplate = gax.MustCompilePathTemplate("projects/{project}")
|
||||
loggingLogPathTemplate = gax.MustCompilePathTemplate("projects/{project}/logs/{log}")
|
||||
)
|
||||
|
||||
// CallOptions contains the retry settings for each method of Client.
|
||||
type CallOptions struct {
|
||||
DeleteLog []gax.CallOption
|
||||
WriteLogEntries []gax.CallOption
|
||||
ListLogEntries []gax.CallOption
|
||||
ListMonitoredResourceDescriptors []gax.CallOption
|
||||
}
|
||||
|
||||
func defaultClientOptions() []option.ClientOption {
|
||||
return []option.ClientOption{
|
||||
option.WithEndpoint("logging.googleapis.com:443"),
|
||||
option.WithScopes(
|
||||
"https://www.googleapis.com/auth/cloud-platform",
|
||||
"https://www.googleapis.com/auth/cloud-platform.read-only",
|
||||
"https://www.googleapis.com/auth/logging.admin",
|
||||
"https://www.googleapis.com/auth/logging.read",
|
||||
"https://www.googleapis.com/auth/logging.write",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func defaultCallOptions() *CallOptions {
|
||||
retry := map[[2]string][]gax.CallOption{
|
||||
{"default", "idempotent"}: {
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnCodes([]codes.Code{
|
||||
codes.DeadlineExceeded,
|
||||
codes.Unavailable,
|
||||
}, gax.Backoff{
|
||||
Initial: 100 * time.Millisecond,
|
||||
Max: 1000 * time.Millisecond,
|
||||
Multiplier: 1.2,
|
||||
})
|
||||
}),
|
||||
},
|
||||
{"list", "idempotent"}: {
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnCodes([]codes.Code{
|
||||
codes.DeadlineExceeded,
|
||||
codes.Unavailable,
|
||||
}, gax.Backoff{
|
||||
Initial: 100 * time.Millisecond,
|
||||
Max: 1000 * time.Millisecond,
|
||||
Multiplier: 1.2,
|
||||
})
|
||||
}),
|
||||
},
|
||||
}
|
||||
return &CallOptions{
|
||||
DeleteLog: retry[[2]string{"default", "idempotent"}],
|
||||
WriteLogEntries: retry[[2]string{"default", "non_idempotent"}],
|
||||
ListLogEntries: retry[[2]string{"list", "idempotent"}],
|
||||
ListMonitoredResourceDescriptors: retry[[2]string{"default", "idempotent"}],
|
||||
}
|
||||
}
|
||||
|
||||
// Client is a client for interacting with Stackdriver Logging API.
|
||||
type Client struct {
|
||||
// The connection to the service.
|
||||
conn *grpc.ClientConn
|
||||
|
||||
// The gRPC API client.
|
||||
client loggingpb.LoggingServiceV2Client
|
||||
|
||||
// The call options for this service.
|
||||
CallOptions *CallOptions
|
||||
|
||||
// The metadata to be sent with each request.
|
||||
metadata metadata.MD
|
||||
}
|
||||
|
||||
// NewClient creates a new logging service v2 client.
|
||||
//
|
||||
// Service for ingesting and querying logs.
|
||||
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
|
||||
conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c := &Client{
|
||||
conn: conn,
|
||||
CallOptions: defaultCallOptions(),
|
||||
|
||||
client: loggingpb.NewLoggingServiceV2Client(conn),
|
||||
}
|
||||
c.SetGoogleClientInfo("gax", gax.Version)
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// Connection returns the client's connection to the API service.
|
||||
func (c *Client) Connection() *grpc.ClientConn {
|
||||
return c.conn
|
||||
}
|
||||
|
||||
// Close closes the connection to the API service. The user should invoke this when
|
||||
// the client is no longer required.
|
||||
func (c *Client) Close() error {
|
||||
return c.conn.Close()
|
||||
}
|
||||
|
||||
// SetGoogleClientInfo sets the name and version of the application in
|
||||
// the `x-goog-api-client` header passed on each request. Intended for
|
||||
// use by Google-written clients.
|
||||
func (c *Client) SetGoogleClientInfo(name, version string) {
|
||||
goVersion := strings.Replace(runtime.Version(), " ", "_", -1)
|
||||
v := fmt.Sprintf("%s/%s %s gax/%s go/%s", name, version, gapicNameVersion, gax.Version, goVersion)
|
||||
c.metadata = metadata.Pairs("x-goog-api-client", v)
|
||||
}
|
||||
|
||||
// LoggingParentPath returns the path for the parent resource.
|
||||
func LoggingParentPath(project string) string {
|
||||
path, err := loggingParentPathTemplate.Render(map[string]string{
|
||||
"project": project,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
// LoggingLogPath returns the path for the log resource.
|
||||
func LoggingLogPath(project, log string) string {
|
||||
path, err := loggingLogPathTemplate.Render(map[string]string{
|
||||
"project": project,
|
||||
"log": log,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
// DeleteLog deletes all the log entries in a log.
|
||||
// The log reappears if it receives new entries.
|
||||
func (c *Client) DeleteLog(ctx context.Context, req *loggingpb.DeleteLogRequest) error {
|
||||
md, _ := metadata.FromContext(ctx)
|
||||
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
_, err = c.client.DeleteLog(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.DeleteLog...)
|
||||
return err
|
||||
}
|
||||
|
||||
// WriteLogEntries writes log entries to Stackdriver Logging. All log entries are
|
||||
// written by this method.
|
||||
func (c *Client) WriteLogEntries(ctx context.Context, req *loggingpb.WriteLogEntriesRequest) (*loggingpb.WriteLogEntriesResponse, error) {
|
||||
md, _ := metadata.FromContext(ctx)
|
||||
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
|
||||
var resp *loggingpb.WriteLogEntriesResponse
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.client.WriteLogEntries(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.WriteLogEntries...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// ListLogEntries lists log entries. Use this method to retrieve log entries from Cloud
|
||||
// Logging. For ways to export log entries, see
|
||||
// [Exporting Logs](/logging/docs/export).
|
||||
func (c *Client) ListLogEntries(ctx context.Context, req *loggingpb.ListLogEntriesRequest) *LogEntryIterator {
|
||||
md, _ := metadata.FromContext(ctx)
|
||||
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
|
||||
it := &LogEntryIterator{}
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.LogEntry, string, error) {
|
||||
var resp *loggingpb.ListLogEntriesResponse
|
||||
req.PageToken = pageToken
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.client.ListLogEntries(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.ListLogEntries...)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return resp.Entries, resp.NextPageToken, nil
|
||||
}
|
||||
fetch := func(pageSize int, pageToken string) (string, error) {
|
||||
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
it.items = append(it.items, items...)
|
||||
return nextPageToken, nil
|
||||
}
|
||||
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
|
||||
return it
|
||||
}
|
||||
|
||||
// ListMonitoredResourceDescriptors lists the monitored resource descriptors used by Stackdriver Logging.
|
||||
func (c *Client) ListMonitoredResourceDescriptors(ctx context.Context, req *loggingpb.ListMonitoredResourceDescriptorsRequest) *MonitoredResourceDescriptorIterator {
|
||||
md, _ := metadata.FromContext(ctx)
|
||||
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
|
||||
it := &MonitoredResourceDescriptorIterator{}
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoredrespb.MonitoredResourceDescriptor, string, error) {
|
||||
var resp *loggingpb.ListMonitoredResourceDescriptorsResponse
|
||||
req.PageToken = pageToken
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.client.ListMonitoredResourceDescriptors(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.ListMonitoredResourceDescriptors...)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return resp.ResourceDescriptors, resp.NextPageToken, nil
|
||||
}
|
||||
fetch := func(pageSize int, pageToken string) (string, error) {
|
||||
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
it.items = append(it.items, items...)
|
||||
return nextPageToken, nil
|
||||
}
|
||||
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
|
||||
return it
|
||||
}
|
||||
|
||||
// LogEntryIterator manages a stream of *loggingpb.LogEntry.
|
||||
type LogEntryIterator struct {
|
||||
items []*loggingpb.LogEntry
|
||||
pageInfo *iterator.PageInfo
|
||||
nextFunc func() error
|
||||
|
||||
// InternalFetch is for use by the Google Cloud Libraries only.
|
||||
// It is not part of the stable interface of this package.
|
||||
//
|
||||
// InternalFetch returns results from a single call to the underlying RPC.
|
||||
// The number of results is no greater than pageSize.
|
||||
// If there are no more results, nextPageToken is empty and err is nil.
|
||||
InternalFetch func(pageSize int, pageToken string) (results []*loggingpb.LogEntry, nextPageToken string, err error)
|
||||
}
|
||||
|
||||
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
|
||||
func (it *LogEntryIterator) PageInfo() *iterator.PageInfo {
|
||||
return it.pageInfo
|
||||
}
|
||||
|
||||
// Next returns the next result. Its second return value is iterator.Done if there are no more
|
||||
// results. Once Next returns Done, all subsequent calls will return Done.
|
||||
func (it *LogEntryIterator) Next() (*loggingpb.LogEntry, error) {
|
||||
var item *loggingpb.LogEntry
|
||||
if err := it.nextFunc(); err != nil {
|
||||
return item, err
|
||||
}
|
||||
item = it.items[0]
|
||||
it.items = it.items[1:]
|
||||
return item, nil
|
||||
}
|
||||
|
||||
func (it *LogEntryIterator) bufLen() int {
|
||||
return len(it.items)
|
||||
}
|
||||
|
||||
func (it *LogEntryIterator) takeBuf() interface{} {
|
||||
b := it.items
|
||||
it.items = nil
|
||||
return b
|
||||
}
|
||||
|
||||
// MonitoredResourceDescriptorIterator manages a stream of *monitoredrespb.MonitoredResourceDescriptor.
|
||||
type MonitoredResourceDescriptorIterator struct {
|
||||
items []*monitoredrespb.MonitoredResourceDescriptor
|
||||
pageInfo *iterator.PageInfo
|
||||
nextFunc func() error
|
||||
|
||||
// InternalFetch is for use by the Google Cloud Libraries only.
|
||||
// It is not part of the stable interface of this package.
|
||||
//
|
||||
// InternalFetch returns results from a single call to the underlying RPC.
|
||||
// The number of results is no greater than pageSize.
|
||||
// If there are no more results, nextPageToken is empty and err is nil.
|
||||
InternalFetch func(pageSize int, pageToken string) (results []*monitoredrespb.MonitoredResourceDescriptor, nextPageToken string, err error)
|
||||
}
|
||||
|
||||
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
|
||||
func (it *MonitoredResourceDescriptorIterator) PageInfo() *iterator.PageInfo {
|
||||
return it.pageInfo
|
||||
}
|
||||
|
||||
// Next returns the next result. Its second return value is iterator.Done if there are no more
|
||||
// results. Once Next returns Done, all subsequent calls will return Done.
|
||||
func (it *MonitoredResourceDescriptorIterator) Next() (*monitoredrespb.MonitoredResourceDescriptor, error) {
|
||||
var item *monitoredrespb.MonitoredResourceDescriptor
|
||||
if err := it.nextFunc(); err != nil {
|
||||
return item, err
|
||||
}
|
||||
item = it.items[0]
|
||||
it.items = it.items[1:]
|
||||
return item, nil
|
||||
}
|
||||
|
||||
func (it *MonitoredResourceDescriptorIterator) bufLen() int {
|
||||
return len(it.items)
|
||||
}
|
||||
|
||||
func (it *MonitoredResourceDescriptorIterator) takeBuf() interface{} {
|
||||
b := it.items
|
||||
it.items = nil
|
||||
return b
|
||||
}
|
299
vendor/cloud.google.com/go/logging/apiv2/metrics_client.go
generated
vendored
Normal file
299
vendor/cloud.google.com/go/logging/apiv2/metrics_client.go
generated
vendored
Normal file
|
@ -0,0 +1,299 @@
|
|||
// Copyright 2016, Google Inc. All rights reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// AUTO-GENERATED CODE. DO NOT EDIT.
|
||||
|
||||
package logging
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
gax "github.com/googleapis/gax-go"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/api/iterator"
|
||||
"google.golang.org/api/option"
|
||||
"google.golang.org/api/transport"
|
||||
loggingpb "google.golang.org/genproto/googleapis/logging/v2"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
var (
|
||||
metricsParentPathTemplate = gax.MustCompilePathTemplate("projects/{project}")
|
||||
metricsMetricPathTemplate = gax.MustCompilePathTemplate("projects/{project}/metrics/{metric}")
|
||||
)
|
||||
|
||||
// MetricsCallOptions contains the retry settings for each method of MetricsClient.
|
||||
type MetricsCallOptions struct {
|
||||
ListLogMetrics []gax.CallOption
|
||||
GetLogMetric []gax.CallOption
|
||||
CreateLogMetric []gax.CallOption
|
||||
UpdateLogMetric []gax.CallOption
|
||||
DeleteLogMetric []gax.CallOption
|
||||
}
|
||||
|
||||
func defaultMetricsClientOptions() []option.ClientOption {
|
||||
return []option.ClientOption{
|
||||
option.WithEndpoint("logging.googleapis.com:443"),
|
||||
option.WithScopes(
|
||||
"https://www.googleapis.com/auth/cloud-platform",
|
||||
"https://www.googleapis.com/auth/cloud-platform.read-only",
|
||||
"https://www.googleapis.com/auth/logging.admin",
|
||||
"https://www.googleapis.com/auth/logging.read",
|
||||
"https://www.googleapis.com/auth/logging.write",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func defaultMetricsCallOptions() *MetricsCallOptions {
|
||||
retry := map[[2]string][]gax.CallOption{
|
||||
{"default", "idempotent"}: {
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnCodes([]codes.Code{
|
||||
codes.DeadlineExceeded,
|
||||
codes.Unavailable,
|
||||
}, gax.Backoff{
|
||||
Initial: 100 * time.Millisecond,
|
||||
Max: 1000 * time.Millisecond,
|
||||
Multiplier: 1.2,
|
||||
})
|
||||
}),
|
||||
},
|
||||
}
|
||||
return &MetricsCallOptions{
|
||||
ListLogMetrics: retry[[2]string{"default", "idempotent"}],
|
||||
GetLogMetric: retry[[2]string{"default", "idempotent"}],
|
||||
CreateLogMetric: retry[[2]string{"default", "non_idempotent"}],
|
||||
UpdateLogMetric: retry[[2]string{"default", "non_idempotent"}],
|
||||
DeleteLogMetric: retry[[2]string{"default", "idempotent"}],
|
||||
}
|
||||
}
|
||||
|
||||
// MetricsClient is a client for interacting with Stackdriver Logging API.
|
||||
type MetricsClient struct {
|
||||
// The connection to the service.
|
||||
conn *grpc.ClientConn
|
||||
|
||||
// The gRPC API client.
|
||||
metricsClient loggingpb.MetricsServiceV2Client
|
||||
|
||||
// The call options for this service.
|
||||
CallOptions *MetricsCallOptions
|
||||
|
||||
// The metadata to be sent with each request.
|
||||
metadata metadata.MD
|
||||
}
|
||||
|
||||
// NewMetricsClient creates a new metrics service v2 client.
|
||||
//
|
||||
// Service for configuring logs-based metrics.
|
||||
func NewMetricsClient(ctx context.Context, opts ...option.ClientOption) (*MetricsClient, error) {
|
||||
conn, err := transport.DialGRPC(ctx, append(defaultMetricsClientOptions(), opts...)...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c := &MetricsClient{
|
||||
conn: conn,
|
||||
CallOptions: defaultMetricsCallOptions(),
|
||||
|
||||
metricsClient: loggingpb.NewMetricsServiceV2Client(conn),
|
||||
}
|
||||
c.SetGoogleClientInfo("gax", gax.Version)
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// Connection returns the client's connection to the API service.
|
||||
func (c *MetricsClient) Connection() *grpc.ClientConn {
|
||||
return c.conn
|
||||
}
|
||||
|
||||
// Close closes the connection to the API service. The user should invoke this when
|
||||
// the client is no longer required.
|
||||
func (c *MetricsClient) Close() error {
|
||||
return c.conn.Close()
|
||||
}
|
||||
|
||||
// SetGoogleClientInfo sets the name and version of the application in
|
||||
// the `x-goog-api-client` header passed on each request. Intended for
|
||||
// use by Google-written clients.
|
||||
func (c *MetricsClient) SetGoogleClientInfo(name, version string) {
|
||||
goVersion := strings.Replace(runtime.Version(), " ", "_", -1)
|
||||
v := fmt.Sprintf("%s/%s %s gax/%s go/%s", name, version, gapicNameVersion, gax.Version, goVersion)
|
||||
c.metadata = metadata.Pairs("x-goog-api-client", v)
|
||||
}
|
||||
|
||||
// MetricsParentPath returns the path for the parent resource.
|
||||
func MetricsParentPath(project string) string {
|
||||
path, err := metricsParentPathTemplate.Render(map[string]string{
|
||||
"project": project,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
// MetricsMetricPath returns the path for the metric resource.
|
||||
func MetricsMetricPath(project, metric string) string {
|
||||
path, err := metricsMetricPathTemplate.Render(map[string]string{
|
||||
"project": project,
|
||||
"metric": metric,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
// ListLogMetrics lists logs-based metrics.
|
||||
func (c *MetricsClient) ListLogMetrics(ctx context.Context, req *loggingpb.ListLogMetricsRequest) *LogMetricIterator {
|
||||
md, _ := metadata.FromContext(ctx)
|
||||
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
|
||||
it := &LogMetricIterator{}
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.LogMetric, string, error) {
|
||||
var resp *loggingpb.ListLogMetricsResponse
|
||||
req.PageToken = pageToken
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.metricsClient.ListLogMetrics(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.ListLogMetrics...)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return resp.Metrics, resp.NextPageToken, nil
|
||||
}
|
||||
fetch := func(pageSize int, pageToken string) (string, error) {
|
||||
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
it.items = append(it.items, items...)
|
||||
return nextPageToken, nil
|
||||
}
|
||||
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
|
||||
return it
|
||||
}
|
||||
|
||||
// GetLogMetric gets a logs-based metric.
|
||||
func (c *MetricsClient) GetLogMetric(ctx context.Context, req *loggingpb.GetLogMetricRequest) (*loggingpb.LogMetric, error) {
|
||||
md, _ := metadata.FromContext(ctx)
|
||||
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
|
||||
var resp *loggingpb.LogMetric
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.metricsClient.GetLogMetric(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.GetLogMetric...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// CreateLogMetric creates a logs-based metric.
|
||||
func (c *MetricsClient) CreateLogMetric(ctx context.Context, req *loggingpb.CreateLogMetricRequest) (*loggingpb.LogMetric, error) {
|
||||
md, _ := metadata.FromContext(ctx)
|
||||
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
|
||||
var resp *loggingpb.LogMetric
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.metricsClient.CreateLogMetric(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.CreateLogMetric...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// UpdateLogMetric creates or updates a logs-based metric.
|
||||
func (c *MetricsClient) UpdateLogMetric(ctx context.Context, req *loggingpb.UpdateLogMetricRequest) (*loggingpb.LogMetric, error) {
|
||||
md, _ := metadata.FromContext(ctx)
|
||||
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
|
||||
var resp *loggingpb.LogMetric
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
resp, err = c.metricsClient.UpdateLogMetric(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.UpdateLogMetric...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// DeleteLogMetric deletes a logs-based metric.
|
||||
func (c *MetricsClient) DeleteLogMetric(ctx context.Context, req *loggingpb.DeleteLogMetricRequest) error {
|
||||
md, _ := metadata.FromContext(ctx)
|
||||
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
|
||||
err := gax.Invoke(ctx, func(ctx context.Context) error {
|
||||
var err error
|
||||
_, err = c.metricsClient.DeleteLogMetric(ctx, req)
|
||||
return err
|
||||
}, c.CallOptions.DeleteLogMetric...)
|
||||
return err
|
||||
}
|
||||
|
||||
// LogMetricIterator manages a stream of *loggingpb.LogMetric.
|
||||
type LogMetricIterator struct {
|
||||
items []*loggingpb.LogMetric
|
||||
pageInfo *iterator.PageInfo
|
||||
nextFunc func() error
|
||||
|
||||
// InternalFetch is for use by the Google Cloud Libraries only.
|
||||
// It is not part of the stable interface of this package.
|
||||
//
|
||||
// InternalFetch returns results from a single call to the underlying RPC.
|
||||
// The number of results is no greater than pageSize.
|
||||
// If there are no more results, nextPageToken is empty and err is nil.
|
||||
InternalFetch func(pageSize int, pageToken string) (results []*loggingpb.LogMetric, nextPageToken string, err error)
|
||||
}
|
||||
|
||||
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
|
||||
func (it *LogMetricIterator) PageInfo() *iterator.PageInfo {
|
||||
return it.pageInfo
|
||||
}
|
||||
|
||||
// Next returns the next result. Its second return value is iterator.Done if there are no more
|
||||
// results. Once Next returns Done, all subsequent calls will return Done.
|
||||
func (it *LogMetricIterator) Next() (*loggingpb.LogMetric, error) {
|
||||
var item *loggingpb.LogMetric
|
||||
if err := it.nextFunc(); err != nil {
|
||||
return item, err
|
||||
}
|
||||
item = it.items[0]
|
||||
it.items = it.items[1:]
|
||||
return item, nil
|
||||
}
|
||||
|
||||
func (it *LogMetricIterator) bufLen() int {
|
||||
return len(it.items)
|
||||
}
|
||||
|
||||
func (it *LogMetricIterator) takeBuf() interface{} {
|
||||
b := it.items
|
||||
it.items = nil
|
||||
return b
|
||||
}
|
89
vendor/cloud.google.com/go/logging/doc.go
generated
vendored
Normal file
89
vendor/cloud.google.com/go/logging/doc.go
generated
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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 logging contains a Stackdriver Logging client suitable for writing logs.
|
||||
For reading logs, and working with sinks, metrics and monitored resources,
|
||||
see package cloud.google.com/go/logging/logadmin.
|
||||
|
||||
This client uses Logging API v2.
|
||||
See https://cloud.google.com/logging/docs/api/v2/ for an introduction to the API.
|
||||
|
||||
This package is experimental and subject to API changes.
|
||||
|
||||
|
||||
Creating a Client
|
||||
|
||||
Use a Client to interact with the Stackdriver Logging API.
|
||||
|
||||
// Create a Client
|
||||
ctx := context.Background()
|
||||
client, err := logging.NewClient(ctx, "my-project")
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
|
||||
|
||||
Basic Usage
|
||||
|
||||
For most use-cases, you'll want to add log entries to a buffer to be periodically
|
||||
flushed (automatically and asynchronously) to the Stackdriver Logging service.
|
||||
|
||||
// Initialize a logger
|
||||
lg := client.Logger("my-log")
|
||||
|
||||
// Add entry to log buffer
|
||||
lg.Log(logging.Entry{Payload: "something happened!"})
|
||||
|
||||
|
||||
Closing your Client
|
||||
|
||||
You should call Client.Close before your program exits to flush any buffered log entries to the Stackdriver Logging service.
|
||||
|
||||
// Close the client when finished.
|
||||
err = client.Close()
|
||||
if err != nil {
|
||||
// TODO: Handle error.
|
||||
}
|
||||
|
||||
|
||||
Synchronous Logging
|
||||
|
||||
For critical errors, you may want to send your log entries immediately.
|
||||
LogSync is slow and will block until the log entry has been sent, so it is
|
||||
not recommended for basic use.
|
||||
|
||||
lg.LogSync(ctx, logging.Entry{Payload: "ALERT! Something critical happened!"})
|
||||
|
||||
|
||||
The Standard Logger Interface
|
||||
|
||||
You may want use a standard log.Logger in your program.
|
||||
|
||||
// stdlg implements log.Logger
|
||||
stdlg := lg.StandardLogger(logging.Info)
|
||||
stdlg.Println("some info")
|
||||
|
||||
|
||||
Log Levels
|
||||
|
||||
An Entry may have one of a number of severity levels associated with it.
|
||||
|
||||
logging.Entry{
|
||||
Payload: "something terrible happened!",
|
||||
Severity: logging.Critical,
|
||||
}
|
||||
|
||||
*/
|
||||
package logging // import "cloud.google.com/go/logging"
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2015 Google Inc. All Rights Reserved.
|
||||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -12,18 +12,19 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// +build go1.5
|
||||
package internal
|
||||
|
||||
package transport
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
import "net/http"
|
||||
const (
|
||||
ProdAddr = "logging.googleapis.com:443"
|
||||
Version = "0.2.0"
|
||||
)
|
||||
|
||||
// makeReqCancel returns a closure that cancels the given http.Request
|
||||
// when called.
|
||||
func makeReqCancel(req *http.Request) func(http.RoundTripper) {
|
||||
c := make(chan struct{})
|
||||
req.Cancel = c
|
||||
return func(http.RoundTripper) {
|
||||
close(c)
|
||||
}
|
||||
func LogPath(parent, logID string) string {
|
||||
logID = strings.Replace(logID, "/", "%2F", -1)
|
||||
return fmt.Sprintf("%s/logs/%s", parent, logID)
|
||||
}
|
674
vendor/cloud.google.com/go/logging/logging.go
generated
vendored
Normal file
674
vendor/cloud.google.com/go/logging/logging.go
generated
vendored
Normal file
|
@ -0,0 +1,674 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// API/gRPC features intentionally missing from this client:
|
||||
// - You cannot have the server pick the time of the entry. This client
|
||||
// always sends a time.
|
||||
// - There is no way to provide a protocol buffer payload.
|
||||
// - No support for the "partial success" feature when writing log entries.
|
||||
|
||||
// TODO(jba): test whether forward-slash characters in the log ID must be URL-encoded.
|
||||
// These features are missing now, but will likely be added:
|
||||
// - There is no way to specify CallOptions.
|
||||
|
||||
package logging
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"math"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
vkit "cloud.google.com/go/logging/apiv2"
|
||||
"cloud.google.com/go/logging/internal"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
structpb "github.com/golang/protobuf/ptypes/struct"
|
||||
tspb "github.com/golang/protobuf/ptypes/timestamp"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/api/option"
|
||||
"google.golang.org/api/support/bundler"
|
||||
mrpb "google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
logtypepb "google.golang.org/genproto/googleapis/logging/type"
|
||||
logpb "google.golang.org/genproto/googleapis/logging/v2"
|
||||
)
|
||||
|
||||
const (
|
||||
// Scope for reading from the logging service.
|
||||
ReadScope = "https://www.googleapis.com/auth/logging.read"
|
||||
|
||||
// Scope for writing to the logging service.
|
||||
WriteScope = "https://www.googleapis.com/auth/logging.write"
|
||||
|
||||
// Scope for administrative actions on the logging service.
|
||||
AdminScope = "https://www.googleapis.com/auth/logging.admin"
|
||||
)
|
||||
|
||||
const (
|
||||
// defaultErrorCapacity is the capacity of the channel used to deliver
|
||||
// errors to the OnError function.
|
||||
defaultErrorCapacity = 10
|
||||
|
||||
// DefaultDelayThreshold is the default value for the DelayThreshold LoggerOption.
|
||||
DefaultDelayThreshold = time.Second
|
||||
|
||||
// DefaultEntryCountThreshold is the default value for the EntryCountThreshold LoggerOption.
|
||||
DefaultEntryCountThreshold = 1000
|
||||
|
||||
// DefaultEntryByteThreshold is the default value for the EntryByteThreshold LoggerOption.
|
||||
DefaultEntryByteThreshold = 1 << 20 // 1MiB
|
||||
|
||||
// DefaultBufferedByteLimit is the default value for the BufferedByteLimit LoggerOption.
|
||||
DefaultBufferedByteLimit = 1 << 30 // 1GiB
|
||||
)
|
||||
|
||||
// For testing:
|
||||
var now = time.Now
|
||||
|
||||
// ErrOverflow signals that the number of buffered entries for a Logger
|
||||
// exceeds its BufferLimit.
|
||||
var ErrOverflow = errors.New("logging: log entry overflowed buffer limits")
|
||||
|
||||
// Client is a Logging client. A Client is associated with a single Cloud project.
|
||||
type Client struct {
|
||||
client *vkit.Client // client for the logging service
|
||||
projectID string
|
||||
errc chan error // should be buffered to minimize dropped errors
|
||||
donec chan struct{} // closed on Client.Close to close Logger bundlers
|
||||
loggers sync.WaitGroup // so we can wait for loggers to close
|
||||
closed bool
|
||||
|
||||
// OnError is called when an error occurs in a call to Log or Flush. The
|
||||
// error may be due to an invalid Entry, an overflow because BufferLimit
|
||||
// was reached (in which case the error will be ErrOverflow) or an error
|
||||
// communicating with the logging service. OnError is called with errors
|
||||
// from all Loggers. It is never called concurrently. OnError is expected
|
||||
// to return quickly; if errors occur while OnError is running, some may
|
||||
// not be reported. The default behavior is to call log.Printf.
|
||||
//
|
||||
// This field should be set only once, before any method of Client is called.
|
||||
OnError func(err error)
|
||||
}
|
||||
|
||||
// NewClient returns a new logging client associated with the provided project ID.
|
||||
//
|
||||
// By default NewClient uses WriteScope. To use a different scope, call
|
||||
// NewClient using a WithScopes option (see https://godoc.org/google.golang.org/api/option#WithScopes).
|
||||
func NewClient(ctx context.Context, projectID string, opts ...option.ClientOption) (*Client, error) {
|
||||
// Check for '/' in project ID to reserve the ability to support various owning resources,
|
||||
// in the form "{Collection}/{Name}", for instance "organizations/my-org".
|
||||
if strings.ContainsRune(projectID, '/') {
|
||||
return nil, errors.New("logging: project ID contains '/'")
|
||||
}
|
||||
opts = append([]option.ClientOption{
|
||||
option.WithEndpoint(internal.ProdAddr),
|
||||
option.WithScopes(WriteScope),
|
||||
}, opts...)
|
||||
c, err := vkit.NewClient(ctx, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c.SetGoogleClientInfo("logging", internal.Version)
|
||||
client := &Client{
|
||||
client: c,
|
||||
projectID: projectID,
|
||||
errc: make(chan error, defaultErrorCapacity), // create a small buffer for errors
|
||||
donec: make(chan struct{}),
|
||||
OnError: func(e error) { log.Printf("logging client: %v", e) },
|
||||
}
|
||||
// Call the user's function synchronously, to make life easier for them.
|
||||
go func() {
|
||||
for err := range client.errc {
|
||||
// This reference to OnError is memory-safe if the user sets OnError before
|
||||
// calling any client methods. The reference happens before the first read from
|
||||
// client.errc, which happens before the first write to client.errc, which
|
||||
// happens before any call, which happens before the user sets OnError.
|
||||
if fn := client.OnError; fn != nil {
|
||||
fn(err)
|
||||
} else {
|
||||
log.Printf("logging (project ID %q): %v", projectID, err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// parent returns the string used in many RPCs to denote the parent resource of the log.
|
||||
func (c *Client) parent() string {
|
||||
return "projects/" + c.projectID
|
||||
}
|
||||
|
||||
var unixZeroTimestamp *tspb.Timestamp
|
||||
|
||||
func init() {
|
||||
var err error
|
||||
unixZeroTimestamp, err = ptypes.TimestampProto(time.Unix(0, 0))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Ping reports whether the client's connection to the logging service and the
|
||||
// authentication configuration are valid. To accomplish this, Ping writes a
|
||||
// log entry "ping" to a log named "ping".
|
||||
func (c *Client) Ping(ctx context.Context) error {
|
||||
ent := &logpb.LogEntry{
|
||||
Payload: &logpb.LogEntry_TextPayload{"ping"},
|
||||
Timestamp: unixZeroTimestamp, // Identical timestamps and insert IDs are both
|
||||
InsertId: "ping", // necessary for the service to dedup these entries.
|
||||
}
|
||||
_, err := c.client.WriteLogEntries(ctx, &logpb.WriteLogEntriesRequest{
|
||||
LogName: internal.LogPath(c.parent(), "ping"),
|
||||
Resource: &mrpb.MonitoredResource{Type: "global"},
|
||||
Entries: []*logpb.LogEntry{ent},
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
// A Logger is used to write log messages to a single log. It can be configured
|
||||
// with a log ID, common monitored resource, and a set of common labels.
|
||||
type Logger struct {
|
||||
client *Client
|
||||
logName string // "projects/{projectID}/logs/{logID}"
|
||||
stdLoggers map[Severity]*log.Logger
|
||||
bundler *bundler.Bundler
|
||||
|
||||
// Options
|
||||
commonResource *mrpb.MonitoredResource
|
||||
commonLabels map[string]string
|
||||
}
|
||||
|
||||
// A LoggerOption is a configuration option for a Logger.
|
||||
type LoggerOption interface {
|
||||
set(*Logger)
|
||||
}
|
||||
|
||||
// CommonResource sets the monitored resource associated with all log entries
|
||||
// written from a Logger. If not provided, a resource of type "global" is used.
|
||||
// This value can be overridden by setting an Entry's Resource field.
|
||||
func CommonResource(r *mrpb.MonitoredResource) LoggerOption { return commonResource{r} }
|
||||
|
||||
type commonResource struct{ *mrpb.MonitoredResource }
|
||||
|
||||
func (r commonResource) set(l *Logger) { l.commonResource = r.MonitoredResource }
|
||||
|
||||
// CommonLabels are labels that apply to all log entries written from a Logger,
|
||||
// so that you don't have to repeat them in each log entry's Labels field. If
|
||||
// any of the log entries contains a (key, value) with the same key that is in
|
||||
// CommonLabels, then the entry's (key, value) overrides the one in
|
||||
// CommonLabels.
|
||||
func CommonLabels(m map[string]string) LoggerOption { return commonLabels(m) }
|
||||
|
||||
type commonLabels map[string]string
|
||||
|
||||
func (c commonLabels) set(l *Logger) { l.commonLabels = c }
|
||||
|
||||
// DelayThreshold is the maximum amount of time that an entry should remain
|
||||
// buffered in memory before a call to the logging service is triggered. Larger
|
||||
// values of DelayThreshold will generally result in fewer calls to the logging
|
||||
// service, while increasing the risk that log entries will be lost if the
|
||||
// process crashes.
|
||||
// The default is DefaultDelayThreshold.
|
||||
func DelayThreshold(d time.Duration) LoggerOption { return delayThreshold(d) }
|
||||
|
||||
type delayThreshold time.Duration
|
||||
|
||||
func (d delayThreshold) set(l *Logger) { l.bundler.DelayThreshold = time.Duration(d) }
|
||||
|
||||
// EntryCountThreshold is the maximum number of entries that will be buffered
|
||||
// in memory before a call to the logging service is triggered. Larger values
|
||||
// will generally result in fewer calls to the logging service, while
|
||||
// increasing both memory consumption and the risk that log entries will be
|
||||
// lost if the process crashes.
|
||||
// The default is DefaultEntryCountThreshold.
|
||||
func EntryCountThreshold(n int) LoggerOption { return entryCountThreshold(n) }
|
||||
|
||||
type entryCountThreshold int
|
||||
|
||||
func (e entryCountThreshold) set(l *Logger) { l.bundler.BundleCountThreshold = int(e) }
|
||||
|
||||
// EntryByteThreshold is the maximum number of bytes of entries that will be
|
||||
// buffered in memory before a call to the logging service is triggered. See
|
||||
// EntryCountThreshold for a discussion of the tradeoffs involved in setting
|
||||
// this option.
|
||||
// The default is DefaultEntryByteThreshold.
|
||||
func EntryByteThreshold(n int) LoggerOption { return entryByteThreshold(n) }
|
||||
|
||||
type entryByteThreshold int
|
||||
|
||||
func (e entryByteThreshold) set(l *Logger) { l.bundler.BundleByteThreshold = int(e) }
|
||||
|
||||
// EntryByteLimit is the maximum number of bytes of entries that will be sent
|
||||
// in a single call to the logging service. This option limits the size of a
|
||||
// single RPC payload, to account for network or service issues with large
|
||||
// RPCs. If EntryByteLimit is smaller than EntryByteThreshold, the latter has
|
||||
// no effect.
|
||||
// The default is zero, meaning there is no limit.
|
||||
func EntryByteLimit(n int) LoggerOption { return entryByteLimit(n) }
|
||||
|
||||
type entryByteLimit int
|
||||
|
||||
func (e entryByteLimit) set(l *Logger) { l.bundler.BundleByteLimit = int(e) }
|
||||
|
||||
// BufferedByteLimit is the maximum number of bytes that the Logger will keep
|
||||
// in memory before returning ErrOverflow. This option limits the total memory
|
||||
// consumption of the Logger (but note that each Logger has its own, separate
|
||||
// limit). It is possible to reach BufferedByteLimit even if it is larger than
|
||||
// EntryByteThreshold or EntryByteLimit, because calls triggered by the latter
|
||||
// two options may be enqueued (and hence occupying memory) while new log
|
||||
// entries are being added.
|
||||
// The default is DefaultBufferedByteLimit.
|
||||
func BufferedByteLimit(n int) LoggerOption { return bufferedByteLimit(n) }
|
||||
|
||||
type bufferedByteLimit int
|
||||
|
||||
func (b bufferedByteLimit) set(l *Logger) { l.bundler.BufferedByteLimit = int(b) }
|
||||
|
||||
// Logger returns a Logger that will write entries with the given log ID, such as
|
||||
// "syslog". A log ID must be less than 512 characters long and can only
|
||||
// include the following characters: upper and lower case alphanumeric
|
||||
// characters: [A-Za-z0-9]; and punctuation characters: forward-slash,
|
||||
// underscore, hyphen, and period.
|
||||
func (c *Client) Logger(logID string, opts ...LoggerOption) *Logger {
|
||||
l := &Logger{
|
||||
client: c,
|
||||
logName: internal.LogPath(c.parent(), logID),
|
||||
commonResource: &mrpb.MonitoredResource{Type: "global"},
|
||||
}
|
||||
// TODO(jba): determine the right context for the bundle handler.
|
||||
ctx := context.TODO()
|
||||
l.bundler = bundler.NewBundler(&logpb.LogEntry{}, func(entries interface{}) {
|
||||
l.writeLogEntries(ctx, entries.([]*logpb.LogEntry))
|
||||
})
|
||||
l.bundler.DelayThreshold = DefaultDelayThreshold
|
||||
l.bundler.BundleCountThreshold = DefaultEntryCountThreshold
|
||||
l.bundler.BundleByteThreshold = DefaultEntryByteThreshold
|
||||
l.bundler.BufferedByteLimit = DefaultBufferedByteLimit
|
||||
for _, opt := range opts {
|
||||
opt.set(l)
|
||||
}
|
||||
|
||||
l.stdLoggers = map[Severity]*log.Logger{}
|
||||
for s := range severityName {
|
||||
l.stdLoggers[s] = log.New(severityWriter{l, s}, "", 0)
|
||||
}
|
||||
c.loggers.Add(1)
|
||||
go func() {
|
||||
defer c.loggers.Done()
|
||||
<-c.donec
|
||||
l.bundler.Close()
|
||||
}()
|
||||
return l
|
||||
}
|
||||
|
||||
type severityWriter struct {
|
||||
l *Logger
|
||||
s Severity
|
||||
}
|
||||
|
||||
func (w severityWriter) Write(p []byte) (n int, err error) {
|
||||
w.l.Log(Entry{
|
||||
Severity: w.s,
|
||||
Payload: string(p),
|
||||
})
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
// Close closes the client.
|
||||
func (c *Client) Close() error {
|
||||
if c.closed {
|
||||
return nil
|
||||
}
|
||||
close(c.donec) // close Logger bundlers
|
||||
c.loggers.Wait() // wait for all bundlers to flush and close
|
||||
// Now there can be no more errors.
|
||||
close(c.errc) // terminate error goroutine
|
||||
// Return only the first error. Since all clients share an underlying connection,
|
||||
// Closes after the first always report a "connection is closing" error.
|
||||
err := c.client.Close()
|
||||
c.closed = true
|
||||
return err
|
||||
}
|
||||
|
||||
// Severity is the severity of the event described in a log entry. These
|
||||
// guideline severity levels are ordered, with numerically smaller levels
|
||||
// treated as less severe than numerically larger levels.
|
||||
type Severity int
|
||||
|
||||
const (
|
||||
// Default means the log entry has no assigned severity level.
|
||||
Default = Severity(logtypepb.LogSeverity_DEFAULT)
|
||||
// Debug means debug or trace information.
|
||||
Debug = Severity(logtypepb.LogSeverity_DEBUG)
|
||||
// Info means routine information, such as ongoing status or performance.
|
||||
Info = Severity(logtypepb.LogSeverity_INFO)
|
||||
// Notice means normal but significant events, such as start up, shut down, or configuration.
|
||||
Notice = Severity(logtypepb.LogSeverity_NOTICE)
|
||||
// Warning means events that might cause problems.
|
||||
Warning = Severity(logtypepb.LogSeverity_WARNING)
|
||||
// Error means events that are likely to cause problems.
|
||||
Error = Severity(logtypepb.LogSeverity_ERROR)
|
||||
// Critical means events that cause more severe problems or brief outages.
|
||||
Critical = Severity(logtypepb.LogSeverity_CRITICAL)
|
||||
// Alert means a person must take an action immediately.
|
||||
Alert = Severity(logtypepb.LogSeverity_ALERT)
|
||||
// Emergency means one or more systems are unusable.
|
||||
Emergency = Severity(logtypepb.LogSeverity_EMERGENCY)
|
||||
)
|
||||
|
||||
var severityName = map[Severity]string{
|
||||
Default: "Default",
|
||||
Debug: "Debug",
|
||||
Info: "Info",
|
||||
Notice: "Notice",
|
||||
Warning: "Warning",
|
||||
Error: "Error",
|
||||
Critical: "Critical",
|
||||
Alert: "Alert",
|
||||
Emergency: "Emergency",
|
||||
}
|
||||
|
||||
// String converts a severity level to a string.
|
||||
func (v Severity) String() string {
|
||||
// same as proto.EnumName
|
||||
s, ok := severityName[v]
|
||||
if ok {
|
||||
return s
|
||||
}
|
||||
return strconv.Itoa(int(v))
|
||||
}
|
||||
|
||||
// ParseSeverity returns the Severity whose name equals s, ignoring case. It
|
||||
// returns Default if no Severity matches.
|
||||
func ParseSeverity(s string) Severity {
|
||||
sl := strings.ToLower(s)
|
||||
for sev, name := range severityName {
|
||||
if strings.ToLower(name) == sl {
|
||||
return sev
|
||||
}
|
||||
}
|
||||
return Default
|
||||
}
|
||||
|
||||
// Entry is a log entry.
|
||||
// See https://cloud.google.com/logging/docs/view/logs_index for more about entries.
|
||||
type Entry struct {
|
||||
// Timestamp is the time of the entry. If zero, the current time is used.
|
||||
Timestamp time.Time
|
||||
|
||||
// Severity is the entry's severity level.
|
||||
// The zero value is Default.
|
||||
Severity Severity
|
||||
|
||||
// Payload must be either a string or something that
|
||||
// marshals via the encoding/json package to a JSON object
|
||||
// (and not any other type of JSON value).
|
||||
Payload interface{}
|
||||
|
||||
// Labels optionally specifies key/value labels for the log entry.
|
||||
// The Logger.Log method takes ownership of this map. See Logger.CommonLabels
|
||||
// for more about labels.
|
||||
Labels map[string]string
|
||||
|
||||
// InsertID is a unique ID for the log entry. If you provide this field,
|
||||
// the logging service considers other log entries in the same log with the
|
||||
// same ID as duplicates which can be removed. If omitted, the logging
|
||||
// service will generate a unique ID for this log entry. Note that because
|
||||
// this client retries RPCs automatically, it is possible (though unlikely)
|
||||
// that an Entry without an InsertID will be written more than once.
|
||||
InsertID string
|
||||
|
||||
// HTTPRequest optionally specifies metadata about the HTTP request
|
||||
// associated with this log entry, if applicable. It is optional.
|
||||
HTTPRequest *HTTPRequest
|
||||
|
||||
// Operation optionally provides information about an operation associated
|
||||
// with the log entry, if applicable.
|
||||
Operation *logpb.LogEntryOperation
|
||||
|
||||
// LogName is the full log name, in the form
|
||||
// "projects/{ProjectID}/logs/{LogID}". It is set by the client when
|
||||
// reading entries. It is an error to set it when writing entries.
|
||||
LogName string
|
||||
|
||||
// Resource is the monitored resource associated with the entry. It is set
|
||||
// by the client when reading entries. It is an error to set it when
|
||||
// writing entries.
|
||||
Resource *mrpb.MonitoredResource
|
||||
}
|
||||
|
||||
// HTTPRequest contains an http.Request as well as additional
|
||||
// information about the request and its response.
|
||||
type HTTPRequest struct {
|
||||
// Request is the http.Request passed to the handler.
|
||||
Request *http.Request
|
||||
|
||||
// RequestSize is the size of the HTTP request message in bytes, including
|
||||
// the request headers and the request body.
|
||||
RequestSize int64
|
||||
|
||||
// Status is the response code indicating the status of the response.
|
||||
// Examples: 200, 404.
|
||||
Status int
|
||||
|
||||
// ResponseSize is the size of the HTTP response message sent back to the client, in bytes,
|
||||
// including the response headers and the response body.
|
||||
ResponseSize int64
|
||||
|
||||
// Latency is the request processing latency on the server, from the time the request was
|
||||
// received until the response was sent.
|
||||
Latency time.Duration
|
||||
|
||||
// RemoteIP is the IP address (IPv4 or IPv6) of the client that issued the
|
||||
// HTTP request. Examples: "192.168.1.1", "FE80::0202:B3FF:FE1E:8329".
|
||||
RemoteIP string
|
||||
|
||||
// CacheHit reports whether an entity was served from cache (with or without
|
||||
// validation).
|
||||
CacheHit bool
|
||||
|
||||
// CacheValidatedWithOriginServer reports whether the response was
|
||||
// validated with the origin server before being served from cache. This
|
||||
// field is only meaningful if CacheHit is true.
|
||||
CacheValidatedWithOriginServer bool
|
||||
}
|
||||
|
||||
func fromHTTPRequest(r *HTTPRequest) *logtypepb.HttpRequest {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
if r.Request == nil {
|
||||
panic("HTTPRequest must have a non-nil Request")
|
||||
}
|
||||
u := *r.Request.URL
|
||||
u.Fragment = ""
|
||||
return &logtypepb.HttpRequest{
|
||||
RequestMethod: r.Request.Method,
|
||||
RequestUrl: u.String(),
|
||||
RequestSize: r.RequestSize,
|
||||
Status: int32(r.Status),
|
||||
ResponseSize: r.ResponseSize,
|
||||
Latency: ptypes.DurationProto(r.Latency),
|
||||
UserAgent: r.Request.UserAgent(),
|
||||
RemoteIp: r.RemoteIP, // TODO(jba): attempt to parse http.Request.RemoteAddr?
|
||||
Referer: r.Request.Referer(),
|
||||
CacheHit: r.CacheHit,
|
||||
CacheValidatedWithOriginServer: r.CacheValidatedWithOriginServer,
|
||||
}
|
||||
}
|
||||
|
||||
// toProtoStruct converts v, which must marshal into a JSON object,
|
||||
// into a Google Struct proto.
|
||||
func toProtoStruct(v interface{}) (*structpb.Struct, error) {
|
||||
// Fast path: if v is already a *structpb.Struct, nothing to do.
|
||||
if s, ok := v.(*structpb.Struct); ok {
|
||||
return s, nil
|
||||
}
|
||||
// v is a Go struct that supports JSON marshalling. We want a Struct
|
||||
// protobuf. Some day we may have a more direct way to get there, but right
|
||||
// now the only way is to marshal the Go struct to JSON, unmarshal into a
|
||||
// map, and then build the Struct proto from the map.
|
||||
jb, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("logging: json.Marshal: %v", err)
|
||||
}
|
||||
var m map[string]interface{}
|
||||
err = json.Unmarshal(jb, &m)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("logging: json.Unmarshal: %v", err)
|
||||
}
|
||||
return jsonMapToProtoStruct(m), nil
|
||||
}
|
||||
|
||||
func jsonMapToProtoStruct(m map[string]interface{}) *structpb.Struct {
|
||||
fields := map[string]*structpb.Value{}
|
||||
for k, v := range m {
|
||||
fields[k] = jsonValueToStructValue(v)
|
||||
}
|
||||
return &structpb.Struct{Fields: fields}
|
||||
}
|
||||
|
||||
func jsonValueToStructValue(v interface{}) *structpb.Value {
|
||||
switch x := v.(type) {
|
||||
case bool:
|
||||
return &structpb.Value{Kind: &structpb.Value_BoolValue{x}}
|
||||
case float64:
|
||||
return &structpb.Value{Kind: &structpb.Value_NumberValue{x}}
|
||||
case string:
|
||||
return &structpb.Value{Kind: &structpb.Value_StringValue{x}}
|
||||
case nil:
|
||||
return &structpb.Value{Kind: &structpb.Value_NullValue{}}
|
||||
case map[string]interface{}:
|
||||
return &structpb.Value{Kind: &structpb.Value_StructValue{jsonMapToProtoStruct(x)}}
|
||||
case []interface{}:
|
||||
var vals []*structpb.Value
|
||||
for _, e := range x {
|
||||
vals = append(vals, jsonValueToStructValue(e))
|
||||
}
|
||||
return &structpb.Value{Kind: &structpb.Value_ListValue{&structpb.ListValue{vals}}}
|
||||
default:
|
||||
panic(fmt.Sprintf("bad type %T for JSON value", v))
|
||||
}
|
||||
}
|
||||
|
||||
// LogSync logs the Entry synchronously without any buffering. Because LogSync is slow
|
||||
// and will block, it is intended primarily for debugging or critical errors.
|
||||
// Prefer Log for most uses.
|
||||
// TODO(jba): come up with a better name (LogNow?) or eliminate.
|
||||
func (l *Logger) LogSync(ctx context.Context, e Entry) error {
|
||||
ent, err := toLogEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = l.client.client.WriteLogEntries(ctx, &logpb.WriteLogEntriesRequest{
|
||||
LogName: l.logName,
|
||||
Resource: l.commonResource,
|
||||
Labels: l.commonLabels,
|
||||
Entries: []*logpb.LogEntry{ent},
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
// Log buffers the Entry for output to the logging service. It never blocks.
|
||||
func (l *Logger) Log(e Entry) {
|
||||
ent, err := toLogEntry(e)
|
||||
if err != nil {
|
||||
l.error(err)
|
||||
return
|
||||
}
|
||||
if err := l.bundler.Add(ent, proto.Size(ent)); err != nil {
|
||||
l.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Flush blocks until all currently buffered log entries are sent.
|
||||
func (l *Logger) Flush() {
|
||||
l.bundler.Flush()
|
||||
}
|
||||
|
||||
func (l *Logger) writeLogEntries(ctx context.Context, entries []*logpb.LogEntry) {
|
||||
req := &logpb.WriteLogEntriesRequest{
|
||||
LogName: l.logName,
|
||||
Resource: l.commonResource,
|
||||
Labels: l.commonLabels,
|
||||
Entries: entries,
|
||||
}
|
||||
_, err := l.client.client.WriteLogEntries(ctx, req)
|
||||
if err != nil {
|
||||
l.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
// error puts the error on the client's error channel
|
||||
// without blocking.
|
||||
func (l *Logger) error(err error) {
|
||||
select {
|
||||
case l.client.errc <- err:
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
// StandardLogger returns a *log.Logger for the provided severity.
|
||||
//
|
||||
// This method is cheap. A single log.Logger is pre-allocated for each
|
||||
// severity level in each Logger. Callers may mutate the returned log.Logger
|
||||
// (for example by calling SetFlags or SetPrefix).
|
||||
func (l *Logger) StandardLogger(s Severity) *log.Logger { return l.stdLoggers[s] }
|
||||
|
||||
func trunc32(i int) int32 {
|
||||
if i > math.MaxInt32 {
|
||||
i = math.MaxInt32
|
||||
}
|
||||
return int32(i)
|
||||
}
|
||||
|
||||
func toLogEntry(e Entry) (*logpb.LogEntry, error) {
|
||||
if e.LogName != "" {
|
||||
return nil, errors.New("logging: Entry.LogName should be not be set when writing")
|
||||
}
|
||||
t := e.Timestamp
|
||||
if t.IsZero() {
|
||||
t = now()
|
||||
}
|
||||
ts, err := ptypes.TimestampProto(t)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ent := &logpb.LogEntry{
|
||||
Timestamp: ts,
|
||||
Severity: logtypepb.LogSeverity(e.Severity),
|
||||
InsertId: e.InsertID,
|
||||
HttpRequest: fromHTTPRequest(e.HTTPRequest),
|
||||
Operation: e.Operation,
|
||||
Labels: e.Labels,
|
||||
}
|
||||
|
||||
switch p := e.Payload.(type) {
|
||||
case string:
|
||||
ent.Payload = &logpb.LogEntry_TextPayload{p}
|
||||
default:
|
||||
s, err := toProtoStruct(p)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ent.Payload = &logpb.LogEntry_JsonPayload{s}
|
||||
}
|
||||
return ent, nil
|
||||
}
|
69
vendor/github.com/golang/protobuf/ptypes/empty/empty.pb.go
generated
vendored
Normal file
69
vendor/github.com/golang/protobuf/ptypes/empty/empty.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: github.com/golang/protobuf/ptypes/empty/empty.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package empty is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
github.com/golang/protobuf/ptypes/empty/empty.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Empty
|
||||
*/
|
||||
package empty
|
||||
|
||||
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
|
||||
|
||||
// A generic empty message that you can re-use to avoid defining duplicated
|
||||
// empty messages in your APIs. A typical example is to use it as the request
|
||||
// or the response type of an API method. For instance:
|
||||
//
|
||||
// service Foo {
|
||||
// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
||||
// }
|
||||
//
|
||||
// The JSON representation for `Empty` is empty JSON object `{}`.
|
||||
type Empty struct {
|
||||
}
|
||||
|
||||
func (m *Empty) Reset() { *m = Empty{} }
|
||||
func (m *Empty) String() string { return proto.CompactTextString(m) }
|
||||
func (*Empty) ProtoMessage() {}
|
||||
func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
func (*Empty) XXX_WellKnownType() string { return "Empty" }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Empty)(nil), "google.protobuf.Empty")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("github.com/golang/protobuf/ptypes/empty/empty.proto", fileDescriptor0)
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 150 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x32, 0x4e, 0xcf, 0x2c, 0xc9,
|
||||
0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x2f, 0x28,
|
||||
0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0x28, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x4f, 0xcd,
|
||||
0x2d, 0x28, 0xa9, 0x84, 0x90, 0x7a, 0x60, 0x39, 0x21, 0xfe, 0xf4, 0xfc, 0xfc, 0xf4, 0x9c, 0x54,
|
||||
0x3d, 0x98, 0x4a, 0x25, 0x76, 0x2e, 0x56, 0x57, 0x90, 0xbc, 0x53, 0x25, 0x97, 0x70, 0x72, 0x7e,
|
||||
0xae, 0x1e, 0x9a, 0xbc, 0x13, 0x17, 0x58, 0x36, 0x00, 0xc4, 0x0d, 0x60, 0x8c, 0x52, 0x27, 0xd2,
|
||||
0xce, 0x05, 0x8c, 0x8c, 0x3f, 0x18, 0x19, 0x17, 0x31, 0x31, 0xbb, 0x07, 0x38, 0xad, 0x62, 0x92,
|
||||
0x73, 0x87, 0x18, 0x1a, 0x00, 0x55, 0xaa, 0x17, 0x9e, 0x9a, 0x93, 0xe3, 0x9d, 0x97, 0x5f, 0x9e,
|
||||
0x17, 0x02, 0xd2, 0x92, 0xc4, 0x06, 0x36, 0xc3, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x7f, 0xbb,
|
||||
0xf4, 0x0e, 0xd2, 0x00, 0x00, 0x00,
|
||||
}
|
53
vendor/github.com/golang/protobuf/ptypes/empty/empty.proto
generated
vendored
Normal file
53
vendor/github.com/golang/protobuf/ptypes/empty/empty.proto
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.protobuf;
|
||||
|
||||
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||
option go_package = "github.com/golang/protobuf/ptypes/empty";
|
||||
option java_package = "com.google.protobuf";
|
||||
option java_outer_classname = "EmptyProto";
|
||||
option java_multiple_files = true;
|
||||
option java_generate_equals_and_hash = true;
|
||||
option objc_class_prefix = "GPB";
|
||||
option cc_enable_arenas = true;
|
||||
|
||||
// A generic empty message that you can re-use to avoid defining duplicated
|
||||
// empty messages in your APIs. A typical example is to use it as the request
|
||||
// or the response type of an API method. For instance:
|
||||
//
|
||||
// service Foo {
|
||||
// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
||||
// }
|
||||
//
|
||||
// The JSON representation for `Empty` is empty JSON object `{}`.
|
||||
message Empty {}
|
382
vendor/github.com/golang/protobuf/ptypes/struct/struct.pb.go
generated
vendored
Normal file
382
vendor/github.com/golang/protobuf/ptypes/struct/struct.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,382 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: github.com/golang/protobuf/ptypes/struct/struct.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package structpb is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
github.com/golang/protobuf/ptypes/struct/struct.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Struct
|
||||
Value
|
||||
ListValue
|
||||
*/
|
||||
package structpb
|
||||
|
||||
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
|
||||
|
||||
// `NullValue` is a singleton enumeration to represent the null value for the
|
||||
// `Value` type union.
|
||||
//
|
||||
// The JSON representation for `NullValue` is JSON `null`.
|
||||
type NullValue int32
|
||||
|
||||
const (
|
||||
// Null value.
|
||||
NullValue_NULL_VALUE NullValue = 0
|
||||
)
|
||||
|
||||
var NullValue_name = map[int32]string{
|
||||
0: "NULL_VALUE",
|
||||
}
|
||||
var NullValue_value = map[string]int32{
|
||||
"NULL_VALUE": 0,
|
||||
}
|
||||
|
||||
func (x NullValue) String() string {
|
||||
return proto.EnumName(NullValue_name, int32(x))
|
||||
}
|
||||
func (NullValue) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
func (NullValue) XXX_WellKnownType() string { return "NullValue" }
|
||||
|
||||
// `Struct` represents a structured data value, consisting of fields
|
||||
// which map to dynamically typed values. In some languages, `Struct`
|
||||
// might be supported by a native representation. For example, in
|
||||
// scripting languages like JS a struct is represented as an
|
||||
// object. The details of that representation are described together
|
||||
// with the proto support for the language.
|
||||
//
|
||||
// The JSON representation for `Struct` is JSON object.
|
||||
type Struct struct {
|
||||
// Unordered map of dynamically typed values.
|
||||
Fields map[string]*Value `protobuf:"bytes,1,rep,name=fields" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
}
|
||||
|
||||
func (m *Struct) Reset() { *m = Struct{} }
|
||||
func (m *Struct) String() string { return proto.CompactTextString(m) }
|
||||
func (*Struct) ProtoMessage() {}
|
||||
func (*Struct) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
func (*Struct) XXX_WellKnownType() string { return "Struct" }
|
||||
|
||||
func (m *Struct) GetFields() map[string]*Value {
|
||||
if m != nil {
|
||||
return m.Fields
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// `Value` represents a dynamically typed value which can be either
|
||||
// null, a number, a string, a boolean, a recursive struct value, or a
|
||||
// list of values. A producer of value is expected to set one of that
|
||||
// variants, absence of any variant indicates an error.
|
||||
//
|
||||
// The JSON representation for `Value` is JSON value.
|
||||
type Value struct {
|
||||
// The kind of value.
|
||||
//
|
||||
// Types that are valid to be assigned to Kind:
|
||||
// *Value_NullValue
|
||||
// *Value_NumberValue
|
||||
// *Value_StringValue
|
||||
// *Value_BoolValue
|
||||
// *Value_StructValue
|
||||
// *Value_ListValue
|
||||
Kind isValue_Kind `protobuf_oneof:"kind"`
|
||||
}
|
||||
|
||||
func (m *Value) Reset() { *m = Value{} }
|
||||
func (m *Value) String() string { return proto.CompactTextString(m) }
|
||||
func (*Value) ProtoMessage() {}
|
||||
func (*Value) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
func (*Value) XXX_WellKnownType() string { return "Value" }
|
||||
|
||||
type isValue_Kind interface {
|
||||
isValue_Kind()
|
||||
}
|
||||
|
||||
type Value_NullValue struct {
|
||||
NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,enum=google.protobuf.NullValue,oneof"`
|
||||
}
|
||||
type Value_NumberValue struct {
|
||||
NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,oneof"`
|
||||
}
|
||||
type Value_StringValue struct {
|
||||
StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,oneof"`
|
||||
}
|
||||
type Value_BoolValue struct {
|
||||
BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,oneof"`
|
||||
}
|
||||
type Value_StructValue struct {
|
||||
StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,oneof"`
|
||||
}
|
||||
type Value_ListValue struct {
|
||||
ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,oneof"`
|
||||
}
|
||||
|
||||
func (*Value_NullValue) isValue_Kind() {}
|
||||
func (*Value_NumberValue) isValue_Kind() {}
|
||||
func (*Value_StringValue) isValue_Kind() {}
|
||||
func (*Value_BoolValue) isValue_Kind() {}
|
||||
func (*Value_StructValue) isValue_Kind() {}
|
||||
func (*Value_ListValue) isValue_Kind() {}
|
||||
|
||||
func (m *Value) GetKind() isValue_Kind {
|
||||
if m != nil {
|
||||
return m.Kind
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Value) GetNullValue() NullValue {
|
||||
if x, ok := m.GetKind().(*Value_NullValue); ok {
|
||||
return x.NullValue
|
||||
}
|
||||
return NullValue_NULL_VALUE
|
||||
}
|
||||
|
||||
func (m *Value) GetNumberValue() float64 {
|
||||
if x, ok := m.GetKind().(*Value_NumberValue); ok {
|
||||
return x.NumberValue
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Value) GetStringValue() string {
|
||||
if x, ok := m.GetKind().(*Value_StringValue); ok {
|
||||
return x.StringValue
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Value) GetBoolValue() bool {
|
||||
if x, ok := m.GetKind().(*Value_BoolValue); ok {
|
||||
return x.BoolValue
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *Value) GetStructValue() *Struct {
|
||||
if x, ok := m.GetKind().(*Value_StructValue); ok {
|
||||
return x.StructValue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Value) GetListValue() *ListValue {
|
||||
if x, ok := m.GetKind().(*Value_ListValue); ok {
|
||||
return x.ListValue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*Value) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
|
||||
return _Value_OneofMarshaler, _Value_OneofUnmarshaler, _Value_OneofSizer, []interface{}{
|
||||
(*Value_NullValue)(nil),
|
||||
(*Value_NumberValue)(nil),
|
||||
(*Value_StringValue)(nil),
|
||||
(*Value_BoolValue)(nil),
|
||||
(*Value_StructValue)(nil),
|
||||
(*Value_ListValue)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _Value_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*Value)
|
||||
// kind
|
||||
switch x := m.Kind.(type) {
|
||||
case *Value_NullValue:
|
||||
b.EncodeVarint(1<<3 | proto.WireVarint)
|
||||
b.EncodeVarint(uint64(x.NullValue))
|
||||
case *Value_NumberValue:
|
||||
b.EncodeVarint(2<<3 | proto.WireFixed64)
|
||||
b.EncodeFixed64(math.Float64bits(x.NumberValue))
|
||||
case *Value_StringValue:
|
||||
b.EncodeVarint(3<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.StringValue)
|
||||
case *Value_BoolValue:
|
||||
t := uint64(0)
|
||||
if x.BoolValue {
|
||||
t = 1
|
||||
}
|
||||
b.EncodeVarint(4<<3 | proto.WireVarint)
|
||||
b.EncodeVarint(t)
|
||||
case *Value_StructValue:
|
||||
b.EncodeVarint(5<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.StructValue); err != nil {
|
||||
return err
|
||||
}
|
||||
case *Value_ListValue:
|
||||
b.EncodeVarint(6<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.ListValue); err != nil {
|
||||
return err
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("Value.Kind has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _Value_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*Value)
|
||||
switch tag {
|
||||
case 1: // kind.null_value
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeVarint()
|
||||
m.Kind = &Value_NullValue{NullValue(x)}
|
||||
return true, err
|
||||
case 2: // kind.number_value
|
||||
if wire != proto.WireFixed64 {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeFixed64()
|
||||
m.Kind = &Value_NumberValue{math.Float64frombits(x)}
|
||||
return true, err
|
||||
case 3: // kind.string_value
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.Kind = &Value_StringValue{x}
|
||||
return true, err
|
||||
case 4: // kind.bool_value
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeVarint()
|
||||
m.Kind = &Value_BoolValue{x != 0}
|
||||
return true, err
|
||||
case 5: // kind.struct_value
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(Struct)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Kind = &Value_StructValue{msg}
|
||||
return true, err
|
||||
case 6: // kind.list_value
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(ListValue)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Kind = &Value_ListValue{msg}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _Value_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*Value)
|
||||
// kind
|
||||
switch x := m.Kind.(type) {
|
||||
case *Value_NullValue:
|
||||
n += proto.SizeVarint(1<<3 | proto.WireVarint)
|
||||
n += proto.SizeVarint(uint64(x.NullValue))
|
||||
case *Value_NumberValue:
|
||||
n += proto.SizeVarint(2<<3 | proto.WireFixed64)
|
||||
n += 8
|
||||
case *Value_StringValue:
|
||||
n += proto.SizeVarint(3<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(len(x.StringValue)))
|
||||
n += len(x.StringValue)
|
||||
case *Value_BoolValue:
|
||||
n += proto.SizeVarint(4<<3 | proto.WireVarint)
|
||||
n += 1
|
||||
case *Value_StructValue:
|
||||
s := proto.Size(x.StructValue)
|
||||
n += proto.SizeVarint(5<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *Value_ListValue:
|
||||
s := proto.Size(x.ListValue)
|
||||
n += proto.SizeVarint(6<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// `ListValue` is a wrapper around a repeated field of values.
|
||||
//
|
||||
// The JSON representation for `ListValue` is JSON array.
|
||||
type ListValue struct {
|
||||
// Repeated field of dynamically typed values.
|
||||
Values []*Value `protobuf:"bytes,1,rep,name=values" json:"values,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ListValue) Reset() { *m = ListValue{} }
|
||||
func (m *ListValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListValue) ProtoMessage() {}
|
||||
func (*ListValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
func (*ListValue) XXX_WellKnownType() string { return "ListValue" }
|
||||
|
||||
func (m *ListValue) GetValues() []*Value {
|
||||
if m != nil {
|
||||
return m.Values
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Struct)(nil), "google.protobuf.Struct")
|
||||
proto.RegisterType((*Value)(nil), "google.protobuf.Value")
|
||||
proto.RegisterType((*ListValue)(nil), "google.protobuf.ListValue")
|
||||
proto.RegisterEnum("google.protobuf.NullValue", NullValue_name, NullValue_value)
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("github.com/golang/protobuf/ptypes/struct/struct.proto", fileDescriptor0)
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 416 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x8b, 0xd3, 0x40,
|
||||
0x14, 0x80, 0x3b, 0xc9, 0x36, 0x98, 0x17, 0x59, 0x97, 0x11, 0xb4, 0xac, 0xa0, 0xa1, 0x7b, 0x09,
|
||||
0x22, 0x09, 0x56, 0x04, 0x31, 0x5e, 0x0c, 0xac, 0xbb, 0x60, 0x58, 0x62, 0x74, 0x57, 0xf0, 0x52,
|
||||
0x9a, 0x34, 0x8d, 0xa1, 0xd3, 0x99, 0x90, 0xcc, 0x28, 0x3d, 0xfa, 0x2f, 0x3c, 0x8a, 0x47, 0x8f,
|
||||
0xfe, 0x42, 0x99, 0x99, 0x24, 0x4a, 0x4b, 0xc1, 0xd3, 0xf4, 0xbd, 0xf9, 0xde, 0x37, 0xef, 0xbd,
|
||||
0x06, 0x9e, 0x97, 0x15, 0xff, 0x2c, 0x32, 0x3f, 0x67, 0x9b, 0xa0, 0x64, 0x64, 0x41, 0xcb, 0xa0,
|
||||
0x6e, 0x18, 0x67, 0x99, 0x58, 0x05, 0x35, 0xdf, 0xd6, 0x45, 0x1b, 0xb4, 0xbc, 0x11, 0x39, 0xef,
|
||||
0x0e, 0x5f, 0xdd, 0xe2, 0x3b, 0x25, 0x63, 0x25, 0x29, 0xfc, 0x9e, 0x9d, 0x7e, 0x47, 0x60, 0xbd,
|
||||
0x57, 0x04, 0x0e, 0xc1, 0x5a, 0x55, 0x05, 0x59, 0xb6, 0x13, 0xe4, 0x9a, 0x9e, 0x33, 0x3b, 0xf3,
|
||||
0x77, 0x60, 0x5f, 0x83, 0xfe, 0x1b, 0x45, 0x9d, 0x53, 0xde, 0x6c, 0xd3, 0xae, 0xe4, 0xf4, 0x1d,
|
||||
0x38, 0xff, 0xa4, 0xf1, 0x09, 0x98, 0xeb, 0x62, 0x3b, 0x41, 0x2e, 0xf2, 0xec, 0x54, 0xfe, 0xc4,
|
||||
0x4f, 0x60, 0xfc, 0x65, 0x41, 0x44, 0x31, 0x31, 0x5c, 0xe4, 0x39, 0xb3, 0x7b, 0x7b, 0xf2, 0x1b,
|
||||
0x79, 0x9b, 0x6a, 0xe8, 0xa5, 0xf1, 0x02, 0x4d, 0x7f, 0x1b, 0x30, 0x56, 0x49, 0x1c, 0x02, 0x50,
|
||||
0x41, 0xc8, 0x5c, 0x0b, 0xa4, 0xf4, 0x78, 0x76, 0xba, 0x27, 0xb8, 0x12, 0x84, 0x28, 0xfe, 0x72,
|
||||
0x94, 0xda, 0xb4, 0x0f, 0xf0, 0x19, 0xdc, 0xa6, 0x62, 0x93, 0x15, 0xcd, 0xfc, 0xef, 0xfb, 0xe8,
|
||||
0x72, 0x94, 0x3a, 0x3a, 0x3b, 0x40, 0x2d, 0x6f, 0x2a, 0x5a, 0x76, 0x90, 0x29, 0x1b, 0x97, 0x90,
|
||||
0xce, 0x6a, 0xe8, 0x11, 0x40, 0xc6, 0x58, 0xdf, 0xc6, 0x91, 0x8b, 0xbc, 0x5b, 0xf2, 0x29, 0x99,
|
||||
0xd3, 0xc0, 0x2b, 0x65, 0x11, 0x39, 0xef, 0x90, 0xb1, 0x1a, 0xf5, 0xfe, 0x81, 0x3d, 0x76, 0x7a,
|
||||
0x91, 0xf3, 0x61, 0x4a, 0x52, 0xb5, 0x7d, 0xad, 0xa5, 0x6a, 0xf7, 0xa7, 0x8c, 0xab, 0x96, 0x0f,
|
||||
0x53, 0x92, 0x3e, 0x88, 0x2c, 0x38, 0x5a, 0x57, 0x74, 0x39, 0x0d, 0xc1, 0x1e, 0x08, 0xec, 0x83,
|
||||
0xa5, 0x64, 0xfd, 0x3f, 0x7a, 0x68, 0xe9, 0x1d, 0xf5, 0xf8, 0x01, 0xd8, 0xc3, 0x12, 0xf1, 0x31,
|
||||
0xc0, 0xd5, 0x75, 0x1c, 0xcf, 0x6f, 0x5e, 0xc7, 0xd7, 0xe7, 0x27, 0xa3, 0xe8, 0x1b, 0x82, 0xbb,
|
||||
0x39, 0xdb, 0xec, 0x2a, 0x22, 0x47, 0x4f, 0x93, 0xc8, 0x38, 0x41, 0x9f, 0x9e, 0xfe, 0xef, 0x87,
|
||||
0x19, 0xea, 0xa3, 0xce, 0x7e, 0x20, 0xf4, 0xd3, 0x30, 0x2f, 0x92, 0xe8, 0x97, 0xf1, 0xf0, 0x42,
|
||||
0xcb, 0x93, 0xbe, 0xbf, 0x8f, 0x05, 0x21, 0x6f, 0x29, 0xfb, 0x4a, 0x3f, 0xc8, 0xca, 0xcc, 0x52,
|
||||
0xaa, 0x67, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xbc, 0xcf, 0x6d, 0x50, 0xfe, 0x02, 0x00, 0x00,
|
||||
}
|
96
vendor/github.com/golang/protobuf/ptypes/struct/struct.proto
generated
vendored
Normal file
96
vendor/github.com/golang/protobuf/ptypes/struct/struct.proto
generated
vendored
Normal file
|
@ -0,0 +1,96 @@
|
|||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.protobuf;
|
||||
|
||||
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||
option go_package = "github.com/golang/protobuf/ptypes/struct;structpb";
|
||||
option java_package = "com.google.protobuf";
|
||||
option java_outer_classname = "StructProto";
|
||||
option java_multiple_files = true;
|
||||
option java_generate_equals_and_hash = true;
|
||||
option objc_class_prefix = "GPB";
|
||||
|
||||
|
||||
// `Struct` represents a structured data value, consisting of fields
|
||||
// which map to dynamically typed values. In some languages, `Struct`
|
||||
// might be supported by a native representation. For example, in
|
||||
// scripting languages like JS a struct is represented as an
|
||||
// object. The details of that representation are described together
|
||||
// with the proto support for the language.
|
||||
//
|
||||
// The JSON representation for `Struct` is JSON object.
|
||||
message Struct {
|
||||
// Unordered map of dynamically typed values.
|
||||
map<string, Value> fields = 1;
|
||||
}
|
||||
|
||||
// `Value` represents a dynamically typed value which can be either
|
||||
// null, a number, a string, a boolean, a recursive struct value, or a
|
||||
// list of values. A producer of value is expected to set one of that
|
||||
// variants, absence of any variant indicates an error.
|
||||
//
|
||||
// The JSON representation for `Value` is JSON value.
|
||||
message Value {
|
||||
// The kind of value.
|
||||
oneof kind {
|
||||
// Represents a null value.
|
||||
NullValue null_value = 1;
|
||||
// Represents a double value.
|
||||
double number_value = 2;
|
||||
// Represents a string value.
|
||||
string string_value = 3;
|
||||
// Represents a boolean value.
|
||||
bool bool_value = 4;
|
||||
// Represents a structured value.
|
||||
Struct struct_value = 5;
|
||||
// Represents a repeated `Value`.
|
||||
ListValue list_value = 6;
|
||||
}
|
||||
}
|
||||
|
||||
// `NullValue` is a singleton enumeration to represent the null value for the
|
||||
// `Value` type union.
|
||||
//
|
||||
// The JSON representation for `NullValue` is JSON `null`.
|
||||
enum NullValue {
|
||||
// Null value.
|
||||
NULL_VALUE = 0;
|
||||
}
|
||||
|
||||
// `ListValue` is a wrapper around a repeated field of values.
|
||||
//
|
||||
// The JSON representation for `ListValue` is JSON array.
|
||||
message ListValue {
|
||||
// Repeated field of dynamically typed values.
|
||||
repeated Value values = 1;
|
||||
}
|
200
vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.pb.go
generated
vendored
Normal file
200
vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,200 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: github.com/golang/protobuf/ptypes/wrappers/wrappers.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package wrappers is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
github.com/golang/protobuf/ptypes/wrappers/wrappers.proto
|
||||
|
||||
It has these top-level messages:
|
||||
DoubleValue
|
||||
FloatValue
|
||||
Int64Value
|
||||
UInt64Value
|
||||
Int32Value
|
||||
UInt32Value
|
||||
BoolValue
|
||||
StringValue
|
||||
BytesValue
|
||||
*/
|
||||
package wrappers
|
||||
|
||||
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
|
||||
|
||||
// Wrapper message for `double`.
|
||||
//
|
||||
// The JSON representation for `DoubleValue` is JSON number.
|
||||
type DoubleValue struct {
|
||||
// The double value.
|
||||
Value float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *DoubleValue) Reset() { *m = DoubleValue{} }
|
||||
func (m *DoubleValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*DoubleValue) ProtoMessage() {}
|
||||
func (*DoubleValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
func (*DoubleValue) XXX_WellKnownType() string { return "DoubleValue" }
|
||||
|
||||
// Wrapper message for `float`.
|
||||
//
|
||||
// The JSON representation for `FloatValue` is JSON number.
|
||||
type FloatValue struct {
|
||||
// The float value.
|
||||
Value float32 `protobuf:"fixed32,1,opt,name=value" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *FloatValue) Reset() { *m = FloatValue{} }
|
||||
func (m *FloatValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*FloatValue) ProtoMessage() {}
|
||||
func (*FloatValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
func (*FloatValue) XXX_WellKnownType() string { return "FloatValue" }
|
||||
|
||||
// Wrapper message for `int64`.
|
||||
//
|
||||
// The JSON representation for `Int64Value` is JSON string.
|
||||
type Int64Value struct {
|
||||
// The int64 value.
|
||||
Value int64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Int64Value) Reset() { *m = Int64Value{} }
|
||||
func (m *Int64Value) String() string { return proto.CompactTextString(m) }
|
||||
func (*Int64Value) ProtoMessage() {}
|
||||
func (*Int64Value) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
func (*Int64Value) XXX_WellKnownType() string { return "Int64Value" }
|
||||
|
||||
// Wrapper message for `uint64`.
|
||||
//
|
||||
// The JSON representation for `UInt64Value` is JSON string.
|
||||
type UInt64Value struct {
|
||||
// The uint64 value.
|
||||
Value uint64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *UInt64Value) Reset() { *m = UInt64Value{} }
|
||||
func (m *UInt64Value) String() string { return proto.CompactTextString(m) }
|
||||
func (*UInt64Value) ProtoMessage() {}
|
||||
func (*UInt64Value) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
|
||||
func (*UInt64Value) XXX_WellKnownType() string { return "UInt64Value" }
|
||||
|
||||
// Wrapper message for `int32`.
|
||||
//
|
||||
// The JSON representation for `Int32Value` is JSON number.
|
||||
type Int32Value struct {
|
||||
// The int32 value.
|
||||
Value int32 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Int32Value) Reset() { *m = Int32Value{} }
|
||||
func (m *Int32Value) String() string { return proto.CompactTextString(m) }
|
||||
func (*Int32Value) ProtoMessage() {}
|
||||
func (*Int32Value) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
|
||||
func (*Int32Value) XXX_WellKnownType() string { return "Int32Value" }
|
||||
|
||||
// Wrapper message for `uint32`.
|
||||
//
|
||||
// The JSON representation for `UInt32Value` is JSON number.
|
||||
type UInt32Value struct {
|
||||
// The uint32 value.
|
||||
Value uint32 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *UInt32Value) Reset() { *m = UInt32Value{} }
|
||||
func (m *UInt32Value) String() string { return proto.CompactTextString(m) }
|
||||
func (*UInt32Value) ProtoMessage() {}
|
||||
func (*UInt32Value) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
|
||||
func (*UInt32Value) XXX_WellKnownType() string { return "UInt32Value" }
|
||||
|
||||
// Wrapper message for `bool`.
|
||||
//
|
||||
// The JSON representation for `BoolValue` is JSON `true` and `false`.
|
||||
type BoolValue struct {
|
||||
// The bool value.
|
||||
Value bool `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *BoolValue) Reset() { *m = BoolValue{} }
|
||||
func (m *BoolValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*BoolValue) ProtoMessage() {}
|
||||
func (*BoolValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
|
||||
func (*BoolValue) XXX_WellKnownType() string { return "BoolValue" }
|
||||
|
||||
// Wrapper message for `string`.
|
||||
//
|
||||
// The JSON representation for `StringValue` is JSON string.
|
||||
type StringValue struct {
|
||||
// The string value.
|
||||
Value string `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *StringValue) Reset() { *m = StringValue{} }
|
||||
func (m *StringValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*StringValue) ProtoMessage() {}
|
||||
func (*StringValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
|
||||
func (*StringValue) XXX_WellKnownType() string { return "StringValue" }
|
||||
|
||||
// Wrapper message for `bytes`.
|
||||
//
|
||||
// The JSON representation for `BytesValue` is JSON string.
|
||||
type BytesValue struct {
|
||||
// The bytes value.
|
||||
Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *BytesValue) Reset() { *m = BytesValue{} }
|
||||
func (m *BytesValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*BytesValue) ProtoMessage() {}
|
||||
func (*BytesValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
|
||||
func (*BytesValue) XXX_WellKnownType() string { return "BytesValue" }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*DoubleValue)(nil), "google.protobuf.DoubleValue")
|
||||
proto.RegisterType((*FloatValue)(nil), "google.protobuf.FloatValue")
|
||||
proto.RegisterType((*Int64Value)(nil), "google.protobuf.Int64Value")
|
||||
proto.RegisterType((*UInt64Value)(nil), "google.protobuf.UInt64Value")
|
||||
proto.RegisterType((*Int32Value)(nil), "google.protobuf.Int32Value")
|
||||
proto.RegisterType((*UInt32Value)(nil), "google.protobuf.UInt32Value")
|
||||
proto.RegisterType((*BoolValue)(nil), "google.protobuf.BoolValue")
|
||||
proto.RegisterType((*StringValue)(nil), "google.protobuf.StringValue")
|
||||
proto.RegisterType((*BytesValue)(nil), "google.protobuf.BytesValue")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("github.com/golang/protobuf/ptypes/wrappers/wrappers.proto", fileDescriptor0)
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 260 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xb2, 0x4c, 0xcf, 0x2c, 0xc9,
|
||||
0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x2f, 0x28,
|
||||
0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0x28, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2f, 0x2f,
|
||||
0x4a, 0x2c, 0x28, 0x48, 0x2d, 0x42, 0x30, 0xf4, 0xc0, 0x2a, 0x84, 0xf8, 0xd3, 0xf3, 0xf3, 0xd3,
|
||||
0x73, 0x52, 0xf5, 0x60, 0xea, 0x95, 0x94, 0xb9, 0xb8, 0x5d, 0xf2, 0x4b, 0x93, 0x72, 0x52, 0xc3,
|
||||
0x12, 0x73, 0x4a, 0x53, 0x85, 0x44, 0xb8, 0x58, 0xcb, 0x40, 0x0c, 0x09, 0x46, 0x05, 0x46, 0x0d,
|
||||
0xc6, 0x20, 0x08, 0x47, 0x49, 0x89, 0x8b, 0xcb, 0x2d, 0x27, 0x3f, 0xb1, 0x04, 0x8b, 0x1a, 0x26,
|
||||
0x24, 0x35, 0x9e, 0x79, 0x25, 0x66, 0x26, 0x58, 0xd4, 0x30, 0xc3, 0xd4, 0x28, 0x73, 0x71, 0x87,
|
||||
0xe2, 0x52, 0xc4, 0x82, 0x6a, 0x90, 0xb1, 0x11, 0x16, 0x35, 0xac, 0x68, 0x06, 0x61, 0x55, 0xc4,
|
||||
0x0b, 0x53, 0xa4, 0xc8, 0xc5, 0xe9, 0x94, 0x9f, 0x9f, 0x83, 0x45, 0x09, 0x07, 0x92, 0x39, 0xc1,
|
||||
0x25, 0x45, 0x99, 0x79, 0xe9, 0x58, 0x14, 0x71, 0x22, 0x39, 0xc8, 0xa9, 0xb2, 0x24, 0xb5, 0x18,
|
||||
0x8b, 0x1a, 0x1e, 0xa8, 0x1a, 0xa7, 0x7a, 0x2e, 0xe1, 0xe4, 0xfc, 0x5c, 0x3d, 0xb4, 0xd0, 0x75,
|
||||
0xe2, 0x0d, 0x87, 0x06, 0x7f, 0x00, 0x48, 0x24, 0x80, 0x31, 0x4a, 0x8b, 0xf8, 0xa8, 0x5b, 0xc0,
|
||||
0xc8, 0xf8, 0x83, 0x91, 0x71, 0x11, 0x13, 0xb3, 0x7b, 0x80, 0xd3, 0x2a, 0x26, 0x39, 0x77, 0x88,
|
||||
0xd1, 0x01, 0x50, 0xd5, 0x7a, 0xe1, 0xa9, 0x39, 0x39, 0xde, 0x79, 0xf9, 0xe5, 0x79, 0x21, 0x20,
|
||||
0x5d, 0x49, 0x6c, 0x60, 0x63, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa9, 0xdf, 0x64, 0x4b,
|
||||
0x1c, 0x02, 0x00, 0x00,
|
||||
}
|
119
vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.proto
generated
vendored
Normal file
119
vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.proto
generated
vendored
Normal file
|
@ -0,0 +1,119 @@
|
|||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Wrappers for primitive (non-message) types. These types are useful
|
||||
// for embedding primitives in the `google.protobuf.Any` type and for places
|
||||
// where we need to distinguish between the absence of a primitive
|
||||
// typed field and its default value.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.protobuf;
|
||||
|
||||
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||
option cc_enable_arenas = true;
|
||||
option go_package = "github.com/golang/protobuf/ptypes/wrappers";
|
||||
option java_package = "com.google.protobuf";
|
||||
option java_outer_classname = "WrappersProto";
|
||||
option java_multiple_files = true;
|
||||
option java_generate_equals_and_hash = true;
|
||||
option objc_class_prefix = "GPB";
|
||||
|
||||
// Wrapper message for `double`.
|
||||
//
|
||||
// The JSON representation for `DoubleValue` is JSON number.
|
||||
message DoubleValue {
|
||||
// The double value.
|
||||
double value = 1;
|
||||
}
|
||||
|
||||
// Wrapper message for `float`.
|
||||
//
|
||||
// The JSON representation for `FloatValue` is JSON number.
|
||||
message FloatValue {
|
||||
// The float value.
|
||||
float value = 1;
|
||||
}
|
||||
|
||||
// Wrapper message for `int64`.
|
||||
//
|
||||
// The JSON representation for `Int64Value` is JSON string.
|
||||
message Int64Value {
|
||||
// The int64 value.
|
||||
int64 value = 1;
|
||||
}
|
||||
|
||||
// Wrapper message for `uint64`.
|
||||
//
|
||||
// The JSON representation for `UInt64Value` is JSON string.
|
||||
message UInt64Value {
|
||||
// The uint64 value.
|
||||
uint64 value = 1;
|
||||
}
|
||||
|
||||
// Wrapper message for `int32`.
|
||||
//
|
||||
// The JSON representation for `Int32Value` is JSON number.
|
||||
message Int32Value {
|
||||
// The int32 value.
|
||||
int32 value = 1;
|
||||
}
|
||||
|
||||
// Wrapper message for `uint32`.
|
||||
//
|
||||
// The JSON representation for `UInt32Value` is JSON number.
|
||||
message UInt32Value {
|
||||
// The uint32 value.
|
||||
uint32 value = 1;
|
||||
}
|
||||
|
||||
// Wrapper message for `bool`.
|
||||
//
|
||||
// The JSON representation for `BoolValue` is JSON `true` and `false`.
|
||||
message BoolValue {
|
||||
// The bool value.
|
||||
bool value = 1;
|
||||
}
|
||||
|
||||
// Wrapper message for `string`.
|
||||
//
|
||||
// The JSON representation for `StringValue` is JSON string.
|
||||
message StringValue {
|
||||
// The string value.
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
// Wrapper message for `bytes`.
|
||||
//
|
||||
// The JSON representation for `BytesValue` is JSON string.
|
||||
message BytesValue {
|
||||
// The bytes value.
|
||||
bytes value = 1;
|
||||
}
|
27
vendor/github.com/googleapis/gax-go/LICENSE
generated
vendored
Normal file
27
vendor/github.com/googleapis/gax-go/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
Copyright 2016, Google Inc.
|
||||
All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
136
vendor/github.com/googleapis/gax-go/call_option.go
generated
vendored
Normal file
136
vendor/github.com/googleapis/gax-go/call_option.go
generated
vendored
Normal file
|
@ -0,0 +1,136 @@
|
|||
// Copyright 2016, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package gax
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
)
|
||||
|
||||
// CallOption is an option used by Invoke to control behaviors of RPC calls.
|
||||
// CallOption works by modifying relevant fields of CallSettings.
|
||||
type CallOption interface {
|
||||
// Resolve applies the option by modifying cs.
|
||||
Resolve(cs *CallSettings)
|
||||
}
|
||||
|
||||
// Retryer is used by Invoke to determine retry behavior.
|
||||
type Retryer interface {
|
||||
// Retry reports whether a request should be retriedand how long to pause before retrying
|
||||
// if the previous attempt returned with err. Invoke never calls Retry with nil error.
|
||||
Retry(err error) (pause time.Duration, shouldRetry bool)
|
||||
}
|
||||
|
||||
type retryerOption func() Retryer
|
||||
|
||||
func (o retryerOption) Resolve(s *CallSettings) {
|
||||
s.Retry = o
|
||||
}
|
||||
|
||||
// WithRetry sets CallSettings.Retry to fn.
|
||||
func WithRetry(fn func() Retryer) CallOption {
|
||||
return retryerOption(fn)
|
||||
}
|
||||
|
||||
// OnCodes returns a Retryer that retries if and only if
|
||||
// the previous attempt returns a GRPC error whose error code is stored in cc.
|
||||
// Pause times between retries are specified by bo.
|
||||
//
|
||||
// bo is only used for its parameters; each Retryer has its own copy.
|
||||
func OnCodes(cc []codes.Code, bo Backoff) Retryer {
|
||||
return &boRetryer{
|
||||
backoff: bo,
|
||||
codes: append([]codes.Code(nil), cc...),
|
||||
}
|
||||
}
|
||||
|
||||
type boRetryer struct {
|
||||
backoff Backoff
|
||||
codes []codes.Code
|
||||
}
|
||||
|
||||
func (r *boRetryer) Retry(err error) (time.Duration, bool) {
|
||||
c := grpc.Code(err)
|
||||
for _, rc := range r.codes {
|
||||
if c == rc {
|
||||
return r.backoff.Pause(), true
|
||||
}
|
||||
}
|
||||
return 0, false
|
||||
}
|
||||
|
||||
// Backoff implements exponential backoff.
|
||||
// The wait time between retries is a random value between 0 and the "retry envelope".
|
||||
// The envelope starts at Initial and increases by the factor of Multiplier every retry,
|
||||
// but is capped at Max.
|
||||
type Backoff struct {
|
||||
// Initial is the initial value of the retry envelope, defaults to 1 second.
|
||||
Initial time.Duration
|
||||
|
||||
// Max is the maximum value of the retry envelope, defaults to 30 seconds.
|
||||
Max time.Duration
|
||||
|
||||
// Multiplier is the factor by which the retry envelope increases.
|
||||
// It should be greater than 1 and defaults to 2.
|
||||
Multiplier float64
|
||||
|
||||
// cur is the current retry envelope
|
||||
cur time.Duration
|
||||
}
|
||||
|
||||
func (bo *Backoff) Pause() time.Duration {
|
||||
if bo.Initial == 0 {
|
||||
bo.Initial = time.Second
|
||||
}
|
||||
if bo.cur == 0 {
|
||||
bo.cur = bo.Initial
|
||||
}
|
||||
if bo.Max == 0 {
|
||||
bo.Max = 30 * time.Second
|
||||
}
|
||||
if bo.Multiplier < 1 {
|
||||
bo.Multiplier = 2
|
||||
}
|
||||
d := time.Duration(rand.Int63n(int64(bo.cur)))
|
||||
bo.cur = time.Duration(float64(bo.cur) * bo.Multiplier)
|
||||
if bo.cur > bo.Max {
|
||||
bo.cur = bo.Max
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
type CallSettings struct {
|
||||
// Retry returns a Retryer to be used to control retry logic of a method call.
|
||||
// If Retry is nil or the returned Retryer is nil, the call will not be retried.
|
||||
Retry func() Retryer
|
||||
}
|
40
vendor/github.com/googleapis/gax-go/gax.go
generated
vendored
Normal file
40
vendor/github.com/googleapis/gax-go/gax.go
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
// Copyright 2016, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Package gax contains a set of modules which aid the development of APIs
|
||||
// for clients and servers based on gRPC and Google API conventions.
|
||||
//
|
||||
// Application code will rarely need to use this library directly.
|
||||
// However, code generated automatically from API definition files can use it
|
||||
// to simplify code generation and to provide more convenient and idiomatic API surfaces.
|
||||
//
|
||||
// This project is currently experimental and not supported.
|
||||
package gax
|
||||
|
||||
const Version = "0.1.0"
|
90
vendor/github.com/googleapis/gax-go/invoke.go
generated
vendored
Normal file
90
vendor/github.com/googleapis/gax-go/invoke.go
generated
vendored
Normal file
|
@ -0,0 +1,90 @@
|
|||
// Copyright 2016, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package gax
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// A user defined call stub.
|
||||
type APICall func(context.Context) error
|
||||
|
||||
// Invoke calls the given APICall,
|
||||
// performing retries as specified by opts, if any.
|
||||
func Invoke(ctx context.Context, call APICall, opts ...CallOption) error {
|
||||
var settings CallSettings
|
||||
for _, opt := range opts {
|
||||
opt.Resolve(&settings)
|
||||
}
|
||||
return invoke(ctx, call, settings, Sleep)
|
||||
}
|
||||
|
||||
// Sleep is similar to time.Sleep, but it can be interrupted by ctx.Done() closing.
|
||||
// If interrupted, Sleep returns ctx.Err().
|
||||
func Sleep(ctx context.Context, d time.Duration) error {
|
||||
t := time.NewTimer(d)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
t.Stop()
|
||||
return ctx.Err()
|
||||
case <-t.C:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
type sleeper func(ctx context.Context, d time.Duration) error
|
||||
|
||||
// invoke implements Invoke, taking an additional sleeper argument for testing.
|
||||
func invoke(ctx context.Context, call APICall, settings CallSettings, sp sleeper) error {
|
||||
var retryer Retryer
|
||||
for {
|
||||
err := call(ctx)
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
if settings.Retry == nil {
|
||||
return err
|
||||
}
|
||||
if retryer == nil {
|
||||
if r := settings.Retry(); r != nil {
|
||||
retryer = r
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if d, ok := retryer.Retry(err); !ok {
|
||||
return err
|
||||
} else if err = sp(ctx, d); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
176
vendor/github.com/googleapis/gax-go/path_template.go
generated
vendored
Normal file
176
vendor/github.com/googleapis/gax-go/path_template.go
generated
vendored
Normal file
|
@ -0,0 +1,176 @@
|
|||
// Copyright 2016, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package gax
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type matcher interface {
|
||||
match([]string) (int, error)
|
||||
String() string
|
||||
}
|
||||
|
||||
type segment struct {
|
||||
matcher
|
||||
name string
|
||||
}
|
||||
|
||||
type labelMatcher string
|
||||
|
||||
func (ls labelMatcher) match(segments []string) (int, error) {
|
||||
if len(segments) == 0 {
|
||||
return 0, fmt.Errorf("expected %s but no more segments found", ls)
|
||||
}
|
||||
if segments[0] != string(ls) {
|
||||
return 0, fmt.Errorf("expected %s but got %s", ls, segments[0])
|
||||
}
|
||||
return 1, nil
|
||||
}
|
||||
|
||||
func (ls labelMatcher) String() string {
|
||||
return string(ls)
|
||||
}
|
||||
|
||||
type wildcardMatcher int
|
||||
|
||||
func (wm wildcardMatcher) match(segments []string) (int, error) {
|
||||
if len(segments) == 0 {
|
||||
return 0, errors.New("no more segments found")
|
||||
}
|
||||
return 1, nil
|
||||
}
|
||||
|
||||
func (wm wildcardMatcher) String() string {
|
||||
return "*"
|
||||
}
|
||||
|
||||
type pathWildcardMatcher int
|
||||
|
||||
func (pwm pathWildcardMatcher) match(segments []string) (int, error) {
|
||||
length := len(segments) - int(pwm)
|
||||
if length <= 0 {
|
||||
return 0, errors.New("not sufficient segments are supplied for path wildcard")
|
||||
}
|
||||
return length, nil
|
||||
}
|
||||
|
||||
func (pwm pathWildcardMatcher) String() string {
|
||||
return "**"
|
||||
}
|
||||
|
||||
type ParseError struct {
|
||||
Pos int
|
||||
Template string
|
||||
Message string
|
||||
}
|
||||
|
||||
func (pe ParseError) Error() string {
|
||||
return fmt.Sprintf("at %d of template '%s', %s", pe.Pos, pe.Template, pe.Message)
|
||||
}
|
||||
|
||||
// PathTemplate manages the template to build and match with paths used
|
||||
// by API services. It holds a template and variable names in it, and
|
||||
// it can extract matched patterns from a path string or build a path
|
||||
// string from a binding.
|
||||
//
|
||||
// See http.proto in github.com/googleapis/googleapis/ for the details of
|
||||
// the template syntax.
|
||||
type PathTemplate struct {
|
||||
segments []segment
|
||||
}
|
||||
|
||||
// NewPathTemplate parses a path template, and returns a PathTemplate
|
||||
// instance if successful.
|
||||
func NewPathTemplate(template string) (*PathTemplate, error) {
|
||||
return parsePathTemplate(template)
|
||||
}
|
||||
|
||||
// MustCompilePathTemplate is like NewPathTemplate but panics if the
|
||||
// expression cannot be parsed. It simplifies safe initialization of
|
||||
// global variables holding compiled regular expressions.
|
||||
func MustCompilePathTemplate(template string) *PathTemplate {
|
||||
pt, err := NewPathTemplate(template)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return pt
|
||||
}
|
||||
|
||||
// Match attempts to match the given path with the template, and returns
|
||||
// the mapping of the variable name to the matched pattern string.
|
||||
func (pt *PathTemplate) Match(path string) (map[string]string, error) {
|
||||
paths := strings.Split(path, "/")
|
||||
values := map[string]string{}
|
||||
for _, segment := range pt.segments {
|
||||
length, err := segment.match(paths)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if segment.name != "" {
|
||||
value := strings.Join(paths[:length], "/")
|
||||
if oldValue, ok := values[segment.name]; ok {
|
||||
values[segment.name] = oldValue + "/" + value
|
||||
} else {
|
||||
values[segment.name] = value
|
||||
}
|
||||
}
|
||||
paths = paths[length:]
|
||||
}
|
||||
if len(paths) != 0 {
|
||||
return nil, fmt.Errorf("Trailing path %s remains after the matching", strings.Join(paths, "/"))
|
||||
}
|
||||
return values, nil
|
||||
}
|
||||
|
||||
// Render creates a path string from its template and the binding from
|
||||
// the variable name to the value.
|
||||
func (pt *PathTemplate) Render(binding map[string]string) (string, error) {
|
||||
result := make([]string, 0, len(pt.segments))
|
||||
var lastVariableName string
|
||||
for _, segment := range pt.segments {
|
||||
name := segment.name
|
||||
if lastVariableName != "" && name == lastVariableName {
|
||||
continue
|
||||
}
|
||||
lastVariableName = name
|
||||
if name == "" {
|
||||
result = append(result, segment.String())
|
||||
} else if value, ok := binding[name]; ok {
|
||||
result = append(result, value)
|
||||
} else {
|
||||
return "", fmt.Errorf("%s is not found", name)
|
||||
}
|
||||
}
|
||||
built := strings.Join(result, "/")
|
||||
return built, nil
|
||||
}
|
227
vendor/github.com/googleapis/gax-go/path_template_parser.go
generated
vendored
Normal file
227
vendor/github.com/googleapis/gax-go/path_template_parser.go
generated
vendored
Normal file
|
@ -0,0 +1,227 @@
|
|||
// Copyright 2016, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package gax
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// This parser follows the syntax of path templates, from
|
||||
// https://github.com/googleapis/googleapis/blob/master/google/api/http.proto.
|
||||
// The differences are that there is no custom verb, we allow the initial slash
|
||||
// to be absent, and that we are not strict as
|
||||
// https://tools.ietf.org/html/rfc6570 about the characters in identifiers and
|
||||
// literals.
|
||||
|
||||
type pathTemplateParser struct {
|
||||
r *strings.Reader
|
||||
runeCount int // the number of the current rune in the original string
|
||||
nextVar int // the number to use for the next unnamed variable
|
||||
seenName map[string]bool // names we've seen already
|
||||
seenPathWildcard bool // have we seen "**" already?
|
||||
}
|
||||
|
||||
func parsePathTemplate(template string) (pt *PathTemplate, err error) {
|
||||
p := &pathTemplateParser{
|
||||
r: strings.NewReader(template),
|
||||
seenName: map[string]bool{},
|
||||
}
|
||||
|
||||
// Handle panics with strings like errors.
|
||||
// See pathTemplateParser.error, below.
|
||||
defer func() {
|
||||
if x := recover(); x != nil {
|
||||
errmsg, ok := x.(errString)
|
||||
if !ok {
|
||||
panic(x)
|
||||
}
|
||||
pt = nil
|
||||
err = ParseError{p.runeCount, template, string(errmsg)}
|
||||
}
|
||||
}()
|
||||
|
||||
segs := p.template()
|
||||
// If there is a path wildcard, set its length. We can't do this
|
||||
// until we know how many segments we've got all together.
|
||||
for i, seg := range segs {
|
||||
if _, ok := seg.matcher.(pathWildcardMatcher); ok {
|
||||
segs[i].matcher = pathWildcardMatcher(len(segs) - i - 1)
|
||||
break
|
||||
}
|
||||
}
|
||||
return &PathTemplate{segments: segs}, nil
|
||||
|
||||
}
|
||||
|
||||
// Used to indicate errors "thrown" by this parser. We don't use string because
|
||||
// many parts of the standard library panic with strings.
|
||||
type errString string
|
||||
|
||||
// Terminates parsing immediately with an error.
|
||||
func (p *pathTemplateParser) error(msg string) {
|
||||
panic(errString(msg))
|
||||
}
|
||||
|
||||
// Template = [ "/" ] Segments
|
||||
func (p *pathTemplateParser) template() []segment {
|
||||
var segs []segment
|
||||
if p.consume('/') {
|
||||
// Initial '/' needs an initial empty matcher.
|
||||
segs = append(segs, segment{matcher: labelMatcher("")})
|
||||
}
|
||||
return append(segs, p.segments("")...)
|
||||
}
|
||||
|
||||
// Segments = Segment { "/" Segment }
|
||||
func (p *pathTemplateParser) segments(name string) []segment {
|
||||
var segs []segment
|
||||
for {
|
||||
subsegs := p.segment(name)
|
||||
segs = append(segs, subsegs...)
|
||||
if !p.consume('/') {
|
||||
break
|
||||
}
|
||||
}
|
||||
return segs
|
||||
}
|
||||
|
||||
// Segment = "*" | "**" | LITERAL | Variable
|
||||
func (p *pathTemplateParser) segment(name string) []segment {
|
||||
if p.consume('*') {
|
||||
if name == "" {
|
||||
name = fmt.Sprintf("$%d", p.nextVar)
|
||||
p.nextVar++
|
||||
}
|
||||
if p.consume('*') {
|
||||
if p.seenPathWildcard {
|
||||
p.error("multiple '**' disallowed")
|
||||
}
|
||||
p.seenPathWildcard = true
|
||||
// We'll change 0 to the right number at the end.
|
||||
return []segment{{name: name, matcher: pathWildcardMatcher(0)}}
|
||||
}
|
||||
return []segment{{name: name, matcher: wildcardMatcher(0)}}
|
||||
}
|
||||
if p.consume('{') {
|
||||
if name != "" {
|
||||
p.error("recursive named bindings are not allowed")
|
||||
}
|
||||
return p.variable()
|
||||
}
|
||||
return []segment{{name: name, matcher: labelMatcher(p.literal())}}
|
||||
}
|
||||
|
||||
// Variable = "{" FieldPath [ "=" Segments ] "}"
|
||||
// "{" is already consumed.
|
||||
func (p *pathTemplateParser) variable() []segment {
|
||||
// Simplification: treat FieldPath as LITERAL, instead of IDENT { '.' IDENT }
|
||||
name := p.literal()
|
||||
if p.seenName[name] {
|
||||
p.error(name + " appears multiple times")
|
||||
}
|
||||
p.seenName[name] = true
|
||||
var segs []segment
|
||||
if p.consume('=') {
|
||||
segs = p.segments(name)
|
||||
} else {
|
||||
// "{var}" is equivalent to "{var=*}"
|
||||
segs = []segment{{name: name, matcher: wildcardMatcher(0)}}
|
||||
}
|
||||
if !p.consume('}') {
|
||||
p.error("expected '}'")
|
||||
}
|
||||
return segs
|
||||
}
|
||||
|
||||
// A literal is any sequence of characters other than a few special ones.
|
||||
// The list of stop characters is not quite the same as in the template RFC.
|
||||
func (p *pathTemplateParser) literal() string {
|
||||
lit := p.consumeUntil("/*}{=")
|
||||
if lit == "" {
|
||||
p.error("empty literal")
|
||||
}
|
||||
return lit
|
||||
}
|
||||
|
||||
// Read runes until EOF or one of the runes in stopRunes is encountered.
|
||||
// If the latter, unread the stop rune. Return the accumulated runes as a string.
|
||||
func (p *pathTemplateParser) consumeUntil(stopRunes string) string {
|
||||
var runes []rune
|
||||
for {
|
||||
r, ok := p.readRune()
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
if strings.IndexRune(stopRunes, r) >= 0 {
|
||||
p.unreadRune()
|
||||
break
|
||||
}
|
||||
runes = append(runes, r)
|
||||
}
|
||||
return string(runes)
|
||||
}
|
||||
|
||||
// If the next rune is r, consume it and return true.
|
||||
// Otherwise, leave the input unchanged and return false.
|
||||
func (p *pathTemplateParser) consume(r rune) bool {
|
||||
rr, ok := p.readRune()
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
if r == rr {
|
||||
return true
|
||||
}
|
||||
p.unreadRune()
|
||||
return false
|
||||
}
|
||||
|
||||
// Read the next rune from the input. Return it.
|
||||
// The second return value is false at EOF.
|
||||
func (p *pathTemplateParser) readRune() (rune, bool) {
|
||||
r, _, err := p.r.ReadRune()
|
||||
if err == io.EOF {
|
||||
return r, false
|
||||
}
|
||||
if err != nil {
|
||||
p.error(err.Error())
|
||||
}
|
||||
p.runeCount++
|
||||
return r, true
|
||||
}
|
||||
|
||||
// Put the last rune that was read back on the input.
|
||||
func (p *pathTemplateParser) unreadRune() {
|
||||
if err := p.r.UnreadRune(); err != nil {
|
||||
p.error(err.Error())
|
||||
}
|
||||
p.runeCount--
|
||||
}
|
3
vendor/golang.org/x/oauth2/google/appengine.go
generated
vendored
3
vendor/golang.org/x/oauth2/google/appengine.go
generated
vendored
|
@ -20,6 +20,9 @@ var appengineVM bool
|
|||
// Set at init time by appengine_hook.go. If nil, we're not on App Engine.
|
||||
var appengineTokenFunc func(c context.Context, scopes ...string) (token string, expiry time.Time, err error)
|
||||
|
||||
// Set at init time by appengine_hook.go. If nil, we're not on App Engine.
|
||||
var appengineAppIDFunc func(c context.Context) string
|
||||
|
||||
// AppEngineTokenSource returns a token source that fetches tokens
|
||||
// issued to the current App Engine application's service account.
|
||||
// If you are implementing a 3-legged OAuth 2.0 flow on App Engine
|
||||
|
|
1
vendor/golang.org/x/oauth2/google/appengine_hook.go
generated
vendored
1
vendor/golang.org/x/oauth2/google/appengine_hook.go
generated
vendored
|
@ -10,4 +10,5 @@ import "google.golang.org/appengine"
|
|||
|
||||
func init() {
|
||||
appengineTokenFunc = appengine.AccessToken
|
||||
appengineAppIDFunc = appengine.AppID
|
||||
}
|
||||
|
|
1
vendor/golang.org/x/oauth2/google/appenginevm_hook.go
generated
vendored
1
vendor/golang.org/x/oauth2/google/appenginevm_hook.go
generated
vendored
|
@ -11,4 +11,5 @@ import "google.golang.org/appengine"
|
|||
func init() {
|
||||
appengineVM = true
|
||||
appengineTokenFunc = appengine.AccessToken
|
||||
appengineAppIDFunc = appengine.AppID
|
||||
}
|
||||
|
|
115
vendor/golang.org/x/oauth2/google/default.go
generated
vendored
115
vendor/golang.org/x/oauth2/google/default.go
generated
vendored
|
@ -6,7 +6,6 @@ package google
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
@ -14,22 +13,21 @@ import (
|
|||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
"cloud.google.com/go/compute/metadata"
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/oauth2"
|
||||
"golang.org/x/oauth2/jwt"
|
||||
"google.golang.org/cloud/compute/metadata"
|
||||
)
|
||||
|
||||
// DefaultCredentials holds "Application Default Credentials".
|
||||
// For more details, see:
|
||||
// https://developers.google.com/accounts/docs/application-default-credentials
|
||||
type DefaultCredentials struct {
|
||||
ProjectID string // may be empty
|
||||
TokenSource oauth2.TokenSource
|
||||
}
|
||||
|
||||
// DefaultClient returns an HTTP Client that uses the
|
||||
// DefaultTokenSource to obtain authentication credentials.
|
||||
//
|
||||
// This client should be used when developing services
|
||||
// that run on Google App Engine or Google Compute Engine
|
||||
// and use "Application Default Credentials."
|
||||
//
|
||||
// For more details, see:
|
||||
// https://developers.google.com/accounts/docs/application-default-credentials
|
||||
//
|
||||
func DefaultClient(ctx context.Context, scope ...string) (*http.Client, error) {
|
||||
ts, err := DefaultTokenSource(ctx, scope...)
|
||||
if err != nil {
|
||||
|
@ -38,8 +36,18 @@ func DefaultClient(ctx context.Context, scope ...string) (*http.Client, error) {
|
|||
return oauth2.NewClient(ctx, ts), nil
|
||||
}
|
||||
|
||||
// DefaultTokenSource is a token source that uses
|
||||
// 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:
|
||||
|
@ -53,45 +61,40 @@ func DefaultClient(ctx context.Context, scope ...string) (*http.Client, error) {
|
|||
// 4. On Google Compute Engine and Google App Engine Managed VMs, it fetches
|
||||
// credentials from the metadata server.
|
||||
// (In this final case any provided scopes are ignored.)
|
||||
//
|
||||
// For more details, see:
|
||||
// https://developers.google.com/accounts/docs/application-default-credentials
|
||||
//
|
||||
func DefaultTokenSource(ctx context.Context, scope ...string) (oauth2.TokenSource, error) {
|
||||
func FindDefaultCredentials(ctx context.Context, scope ...string) (*DefaultCredentials, error) {
|
||||
// First, try the environment variable.
|
||||
const envVar = "GOOGLE_APPLICATION_CREDENTIALS"
|
||||
if filename := os.Getenv(envVar); filename != "" {
|
||||
ts, err := tokenSourceFromFile(ctx, filename, scope)
|
||||
creds, err := readCredentialsFile(ctx, filename, scope)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("google: error getting credentials using %v environment variable: %v", envVar, err)
|
||||
}
|
||||
return ts, nil
|
||||
return creds, nil
|
||||
}
|
||||
|
||||
// Second, try a well-known file.
|
||||
filename := wellKnownFile()
|
||||
_, err := os.Stat(filename)
|
||||
if err == nil {
|
||||
ts, err2 := tokenSourceFromFile(ctx, filename, scope)
|
||||
if err2 == nil {
|
||||
return ts, nil
|
||||
}
|
||||
err = err2
|
||||
} else if os.IsNotExist(err) {
|
||||
err = nil // ignore this error
|
||||
}
|
||||
if err != nil {
|
||||
if creds, err := readCredentialsFile(ctx, filename, scope); 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 Google App Engine use those credentials.
|
||||
if appengineTokenFunc != nil && !appengineVM {
|
||||
return AppEngineTokenSource(ctx, scope...), nil
|
||||
return &DefaultCredentials{
|
||||
ProjectID: appengineAppIDFunc(ctx),
|
||||
TokenSource: AppEngineTokenSource(ctx, scope...),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Fourth, if we're on Google Compute Engine use the metadata server.
|
||||
if metadata.OnGCE() {
|
||||
return ComputeTokenSource(""), nil
|
||||
id, _ := metadata.ProjectID()
|
||||
return &DefaultCredentials{
|
||||
ProjectID: id,
|
||||
TokenSource: ComputeTokenSource(""),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// None are found; return helpful error.
|
||||
|
@ -107,49 +110,21 @@ func wellKnownFile() string {
|
|||
return filepath.Join(guessUnixHomeDir(), ".config", "gcloud", f)
|
||||
}
|
||||
|
||||
func tokenSourceFromFile(ctx context.Context, filename string, scopes []string) (oauth2.TokenSource, error) {
|
||||
func readCredentialsFile(ctx context.Context, filename string, scopes []string) (*DefaultCredentials, error) {
|
||||
b, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var d struct {
|
||||
// Common fields
|
||||
Type string
|
||||
ClientID string `json:"client_id"`
|
||||
|
||||
// User Credential fields
|
||||
ClientSecret string `json:"client_secret"`
|
||||
RefreshToken string `json:"refresh_token"`
|
||||
|
||||
// Service Account fields
|
||||
ClientEmail string `json:"client_email"`
|
||||
PrivateKeyID string `json:"private_key_id"`
|
||||
PrivateKey string `json:"private_key"`
|
||||
}
|
||||
if err := json.Unmarshal(b, &d); err != nil {
|
||||
var f credentialsFile
|
||||
if err := json.Unmarshal(b, &f); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch d.Type {
|
||||
case "authorized_user":
|
||||
cfg := &oauth2.Config{
|
||||
ClientID: d.ClientID,
|
||||
ClientSecret: d.ClientSecret,
|
||||
Scopes: append([]string{}, scopes...), // copy
|
||||
Endpoint: Endpoint,
|
||||
}
|
||||
tok := &oauth2.Token{RefreshToken: d.RefreshToken}
|
||||
return cfg.TokenSource(ctx, tok), nil
|
||||
case "service_account":
|
||||
cfg := &jwt.Config{
|
||||
Email: d.ClientEmail,
|
||||
PrivateKey: []byte(d.PrivateKey),
|
||||
Scopes: append([]string{}, scopes...), // copy
|
||||
TokenURL: JWTTokenURL,
|
||||
}
|
||||
return cfg.TokenSource(ctx), nil
|
||||
case "":
|
||||
return nil, errors.New("missing 'type' field in credentials")
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown credential type: %q", d.Type)
|
||||
ts, err := f.tokenSource(ctx, append([]string(nil), scopes...))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &DefaultCredentials{
|
||||
ProjectID: f.ProjectID,
|
||||
TokenSource: ts,
|
||||
}, nil
|
||||
}
|
||||
|
|
91
vendor/golang.org/x/oauth2/google/google.go
generated
vendored
91
vendor/golang.org/x/oauth2/google/google.go
generated
vendored
|
@ -21,9 +21,10 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"cloud.google.com/go/compute/metadata"
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/oauth2"
|
||||
"golang.org/x/oauth2/jwt"
|
||||
"google.golang.org/cloud/compute/metadata"
|
||||
)
|
||||
|
||||
// Endpoint is Google's OAuth 2.0 endpoint.
|
||||
|
@ -37,9 +38,10 @@ const JWTTokenURL = "https://accounts.google.com/o/oauth2/token"
|
|||
|
||||
// ConfigFromJSON uses a Google Developers Console client_credentials.json
|
||||
// file to construct a config.
|
||||
// client_credentials.json can be downloadable from https://console.developers.google.com,
|
||||
// under "APIs & Auth" > "Credentials". Download the Web application credentials in the
|
||||
// JSON format and provide the contents of the file as jsonKey.
|
||||
// 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"`
|
||||
|
@ -81,22 +83,77 @@ func ConfigFromJSON(jsonKey []byte, scope ...string) (*oauth2.Config, error) {
|
|||
|
||||
// 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" page under "APIs & Auth" for your
|
||||
// project at https://console.developers.google.com to download a JSON key file.
|
||||
// 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 key struct {
|
||||
Email string `json:"client_email"`
|
||||
PrivateKey string `json:"private_key"`
|
||||
}
|
||||
if err := json.Unmarshal(jsonKey, &key); err != nil {
|
||||
var f credentialsFile
|
||||
if err := json.Unmarshal(jsonKey, &f); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &jwt.Config{
|
||||
Email: key.Email,
|
||||
PrivateKey: []byte(key.PrivateKey),
|
||||
Scopes: scope,
|
||||
TokenURL: JWTTokenURL,
|
||||
}, nil
|
||||
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
|
||||
|
|
3
vendor/golang.org/x/oauth2/google/jwt.go
generated
vendored
3
vendor/golang.org/x/oauth2/google/jwt.go
generated
vendored
|
@ -36,6 +36,7 @@ func JWTAccessTokenSourceFromJSON(jsonKey []byte, audience string) (oauth2.Token
|
|||
email: cfg.Email,
|
||||
audience: audience,
|
||||
pk: pk,
|
||||
pkID: cfg.PrivateKeyID,
|
||||
}
|
||||
tok, err := ts.Token()
|
||||
if err != nil {
|
||||
|
@ -47,6 +48,7 @@ func JWTAccessTokenSourceFromJSON(jsonKey []byte, audience string) (oauth2.Token
|
|||
type jwtAccessTokenSource struct {
|
||||
email, audience string
|
||||
pk *rsa.PrivateKey
|
||||
pkID string
|
||||
}
|
||||
|
||||
func (ts *jwtAccessTokenSource) Token() (*oauth2.Token, error) {
|
||||
|
@ -62,6 +64,7 @@ func (ts *jwtAccessTokenSource) Token() (*oauth2.Token, error) {
|
|||
hdr := &jws.Header{
|
||||
Algorithm: "RS256",
|
||||
Typ: "JWT",
|
||||
KeyID: string(ts.pkID),
|
||||
}
|
||||
msg, err := jws.Encode(hdr, cs, ts.pk)
|
||||
if err != nil {
|
||||
|
|
12
vendor/golang.org/x/oauth2/google/sdk.go
generated
vendored
12
vendor/golang.org/x/oauth2/google/sdk.go
generated
vendored
|
@ -160,9 +160,13 @@ var sdkConfigPath = func() (string, error) {
|
|||
}
|
||||
|
||||
func guessUnixHomeDir() string {
|
||||
usr, err := user.Current()
|
||||
if err == nil {
|
||||
return usr.HomeDir
|
||||
// Prefer $HOME over user.Current due to glibc bug: golang.org/issue/13470
|
||||
if v := os.Getenv("HOME"); v != "" {
|
||||
return v
|
||||
}
|
||||
return os.Getenv("HOME")
|
||||
// Else, fall back to user.Current:
|
||||
if u, err := user.Current(); err == nil {
|
||||
return u.HomeDir
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
|
20
vendor/golang.org/x/oauth2/internal/token.go
generated
vendored
20
vendor/golang.org/x/oauth2/internal/token.go
generated
vendored
|
@ -92,6 +92,7 @@ func (e *expirationTime) UnmarshalJSON(b []byte) error {
|
|||
var brokenAuthHeaderProviders = []string{
|
||||
"https://accounts.google.com/",
|
||||
"https://api.dropbox.com/",
|
||||
"https://api.dropboxapi.com/",
|
||||
"https://api.instagram.com/",
|
||||
"https://api.netatmo.net/",
|
||||
"https://api.odnoklassniki.ru/",
|
||||
|
@ -105,6 +106,7 @@ var brokenAuthHeaderProviders = []string{
|
|||
"https://oauth.sandbox.trainingpeaks.com/",
|
||||
"https://oauth.trainingpeaks.com/",
|
||||
"https://oauth.vk.com/",
|
||||
"https://openapi.baidu.com/",
|
||||
"https://slack.com/",
|
||||
"https://test-sandbox.auth.corp.google.com",
|
||||
"https://test.salesforce.com/",
|
||||
|
@ -113,6 +115,10 @@ var brokenAuthHeaderProviders = []string{
|
|||
"https://www.googleapis.com/",
|
||||
"https://www.linkedin.com/",
|
||||
"https://www.strava.com/oauth/",
|
||||
"https://www.wunderlist.com/oauth/",
|
||||
"https://api.patreon.com/",
|
||||
"https://sandbox.codeswholesale.com/oauth/token",
|
||||
"https://api.codeswholesale.com/oauth/token",
|
||||
}
|
||||
|
||||
func RegisterBrokenAuthHeaderProvider(tokenURL string) {
|
||||
|
@ -142,23 +148,23 @@ func providerAuthHeaderWorks(tokenURL string) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
func RetrieveToken(ctx context.Context, ClientID, ClientSecret, TokenURL string, v url.Values) (*Token, error) {
|
||||
func RetrieveToken(ctx context.Context, clientID, clientSecret, tokenURL string, v url.Values) (*Token, error) {
|
||||
hc, err := ContextClient(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v.Set("client_id", ClientID)
|
||||
bustedAuth := !providerAuthHeaderWorks(TokenURL)
|
||||
if bustedAuth && ClientSecret != "" {
|
||||
v.Set("client_secret", ClientSecret)
|
||||
v.Set("client_id", clientID)
|
||||
bustedAuth := !providerAuthHeaderWorks(tokenURL)
|
||||
if bustedAuth && clientSecret != "" {
|
||||
v.Set("client_secret", clientSecret)
|
||||
}
|
||||
req, err := http.NewRequest("POST", TokenURL, strings.NewReader(v.Encode()))
|
||||
req, err := http.NewRequest("POST", tokenURL, strings.NewReader(v.Encode()))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
if !bustedAuth {
|
||||
req.SetBasicAuth(ClientID, ClientSecret)
|
||||
req.SetBasicAuth(clientID, clientSecret)
|
||||
}
|
||||
r, err := hc.Do(req)
|
||||
if err != nil {
|
||||
|
|
60
vendor/golang.org/x/oauth2/jws/jws.go
generated
vendored
60
vendor/golang.org/x/oauth2/jws/jws.go
generated
vendored
|
@ -2,8 +2,16 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package jws provides encoding and decoding utilities for
|
||||
// signed JWS messages.
|
||||
// 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 (
|
||||
|
@ -64,7 +72,7 @@ func (c *ClaimSet) encode() (string, error) {
|
|||
}
|
||||
|
||||
if len(c.PrivateClaims) == 0 {
|
||||
return base64Encode(b), nil
|
||||
return base64.RawURLEncoding.EncodeToString(b), nil
|
||||
}
|
||||
|
||||
// Marshal private claim set and then append it to b.
|
||||
|
@ -82,7 +90,7 @@ func (c *ClaimSet) encode() (string, error) {
|
|||
}
|
||||
b[len(b)-1] = ',' // Replace closing curly brace with a comma.
|
||||
b = append(b, prv[1:]...) // Append private claims.
|
||||
return base64Encode(b), nil
|
||||
return base64.RawURLEncoding.EncodeToString(b), nil
|
||||
}
|
||||
|
||||
// Header represents the header for the signed JWS payloads.
|
||||
|
@ -92,6 +100,9 @@ type Header struct {
|
|||
|
||||
// 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) {
|
||||
|
@ -99,7 +110,7 @@ func (h *Header) encode() (string, error) {
|
|||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return base64Encode(b), nil
|
||||
return base64.RawURLEncoding.EncodeToString(b), nil
|
||||
}
|
||||
|
||||
// Decode decodes a claim set from a JWS payload.
|
||||
|
@ -110,7 +121,7 @@ func Decode(payload string) (*ClaimSet, error) {
|
|||
// TODO(jbd): Provide more context about the error.
|
||||
return nil, errors.New("jws: invalid token received")
|
||||
}
|
||||
decoded, err := base64Decode(s[1])
|
||||
decoded, err := base64.RawURLEncoding.DecodeString(s[1])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -137,7 +148,7 @@ func EncodeWithSigner(header *Header, c *ClaimSet, sg Signer) (string, error) {
|
|||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return fmt.Sprintf("%s.%s", ss, base64Encode(sig)), nil
|
||||
return fmt.Sprintf("%s.%s", ss, base64.RawURLEncoding.EncodeToString(sig)), nil
|
||||
}
|
||||
|
||||
// Encode encodes a signed JWS with provided header and claim set.
|
||||
|
@ -145,28 +156,27 @@ func EncodeWithSigner(header *Header, c *ClaimSet, sg Signer) (string, error) {
|
|||
func Encode(header *Header, c *ClaimSet, key *rsa.PrivateKey) (string, error) {
|
||||
sg := func(data []byte) (sig []byte, err error) {
|
||||
h := sha256.New()
|
||||
h.Write([]byte(data))
|
||||
h.Write(data)
|
||||
return rsa.SignPKCS1v15(rand.Reader, key, crypto.SHA256, h.Sum(nil))
|
||||
}
|
||||
return EncodeWithSigner(header, c, sg)
|
||||
}
|
||||
|
||||
// base64Encode returns and Base64url encoded version of the input string with any
|
||||
// trailing "=" stripped.
|
||||
func base64Encode(b []byte) string {
|
||||
return strings.TrimRight(base64.URLEncoding.EncodeToString(b), "=")
|
||||
}
|
||||
|
||||
// base64Decode decodes the Base64url encoded string
|
||||
func base64Decode(s string) ([]byte, error) {
|
||||
// add back missing padding
|
||||
switch len(s) % 4 {
|
||||
case 1:
|
||||
s += "==="
|
||||
case 2:
|
||||
s += "=="
|
||||
case 3:
|
||||
s += "="
|
||||
// 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")
|
||||
}
|
||||
return base64.URLEncoding.DecodeString(s)
|
||||
|
||||
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))
|
||||
}
|
||||
|
|
4
vendor/golang.org/x/oauth2/jwt/jwt.go
generated
vendored
4
vendor/golang.org/x/oauth2/jwt/jwt.go
generated
vendored
|
@ -46,6 +46,10 @@ type Config struct {
|
|||
//
|
||||
PrivateKey []byte
|
||||
|
||||
// PrivateKeyID contains an optional hint indicating which key is being
|
||||
// used.
|
||||
PrivateKeyID string
|
||||
|
||||
// Subject is the optional user to impersonate.
|
||||
Subject string
|
||||
|
||||
|
|
6
vendor/golang.org/x/oauth2/oauth2.go
generated
vendored
6
vendor/golang.org/x/oauth2/oauth2.go
generated
vendored
|
@ -21,6 +21,8 @@ import (
|
|||
|
||||
// NoContext is the default context you should supply if not using
|
||||
// your own context.Context (see https://golang.org/x/net/context).
|
||||
//
|
||||
// Deprecated: Use context.Background() or context.TODO() instead.
|
||||
var NoContext = context.TODO()
|
||||
|
||||
// RegisterBrokenAuthHeaderProvider registers an OAuth2 server
|
||||
|
@ -37,6 +39,8 @@ func RegisterBrokenAuthHeaderProvider(tokenURL string) {
|
|||
|
||||
// Config describes a typical 3-legged OAuth2 flow, with both the
|
||||
// client application information and the server's endpoint URLs.
|
||||
// For the client credentials 2-legged OAuth2 flow, see the clientcredentials
|
||||
// package (https://golang.org/x/oauth2/clientcredentials).
|
||||
type Config struct {
|
||||
// ClientID is the application's ID.
|
||||
ClientID string
|
||||
|
@ -295,7 +299,7 @@ func NewClient(ctx context.Context, src TokenSource) *http.Client {
|
|||
if src == nil {
|
||||
c, err := internal.ContextClient(ctx)
|
||||
if err != nil {
|
||||
return &http.Client{Transport: internal.ErrorTransport{err}}
|
||||
return &http.Client{Transport: internal.ErrorTransport{Err: err}}
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
|
177
vendor/google.golang.org/api/gensupport/json.go
generated
vendored
177
vendor/google.golang.org/api/gensupport/json.go
generated
vendored
|
@ -1,177 +0,0 @@
|
|||
// 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 gensupport is an internal implementation detail used by code
|
||||
// generated by the google-api-go-generator tool.
|
||||
//
|
||||
// This package may be modified at any time without regard for backwards
|
||||
// compatibility. It should not be used directly by API users.
|
||||
package gensupport
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// MarshalJSON returns a JSON encoding of schema containing only selected fields.
|
||||
// A field is selected if:
|
||||
// * it has a non-empty value, or
|
||||
// * its field name is present in forceSendFields, and
|
||||
// * it is not a nil pointer or nil interface.
|
||||
// The JSON key for each selected field is taken from the field's json: struct tag.
|
||||
func MarshalJSON(schema interface{}, forceSendFields []string) ([]byte, error) {
|
||||
if len(forceSendFields) == 0 {
|
||||
return json.Marshal(schema)
|
||||
}
|
||||
|
||||
mustInclude := make(map[string]struct{})
|
||||
for _, f := range forceSendFields {
|
||||
mustInclude[f] = struct{}{}
|
||||
}
|
||||
|
||||
dataMap, err := schemaToMap(schema, mustInclude)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return json.Marshal(dataMap)
|
||||
}
|
||||
|
||||
func schemaToMap(schema interface{}, mustInclude map[string]struct{}) (map[string]interface{}, error) {
|
||||
m := make(map[string]interface{})
|
||||
s := reflect.ValueOf(schema)
|
||||
st := s.Type()
|
||||
|
||||
for i := 0; i < s.NumField(); i++ {
|
||||
jsonTag := st.Field(i).Tag.Get("json")
|
||||
if jsonTag == "" {
|
||||
continue
|
||||
}
|
||||
tag, err := parseJSONTag(jsonTag)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tag.ignore {
|
||||
continue
|
||||
}
|
||||
|
||||
v := s.Field(i)
|
||||
f := st.Field(i)
|
||||
if !includeField(v, f, mustInclude) {
|
||||
continue
|
||||
}
|
||||
|
||||
// nil maps are treated as empty maps.
|
||||
if f.Type.Kind() == reflect.Map && v.IsNil() {
|
||||
m[tag.apiName] = map[string]string{}
|
||||
continue
|
||||
}
|
||||
|
||||
// nil slices are treated as empty slices.
|
||||
if f.Type.Kind() == reflect.Slice && v.IsNil() {
|
||||
m[tag.apiName] = []bool{}
|
||||
continue
|
||||
}
|
||||
|
||||
if tag.stringFormat {
|
||||
m[tag.apiName] = formatAsString(v, f.Type.Kind())
|
||||
} else {
|
||||
m[tag.apiName] = v.Interface()
|
||||
}
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// formatAsString returns a string representation of v, dereferencing it first if possible.
|
||||
func formatAsString(v reflect.Value, kind reflect.Kind) string {
|
||||
if kind == reflect.Ptr && !v.IsNil() {
|
||||
v = v.Elem()
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%v", v.Interface())
|
||||
}
|
||||
|
||||
// jsonTag represents a restricted version of the struct tag format used by encoding/json.
|
||||
// It is used to describe the JSON encoding of fields in a Schema struct.
|
||||
type jsonTag struct {
|
||||
apiName string
|
||||
stringFormat bool
|
||||
ignore bool
|
||||
}
|
||||
|
||||
// parseJSONTag parses a restricted version of the struct tag format used by encoding/json.
|
||||
// The format of the tag must match that generated by the Schema.writeSchemaStruct method
|
||||
// in the api generator.
|
||||
func parseJSONTag(val string) (jsonTag, error) {
|
||||
if val == "-" {
|
||||
return jsonTag{ignore: true}, nil
|
||||
}
|
||||
|
||||
var tag jsonTag
|
||||
|
||||
i := strings.Index(val, ",")
|
||||
if i == -1 || val[:i] == "" {
|
||||
return tag, fmt.Errorf("malformed json tag: %s", val)
|
||||
}
|
||||
|
||||
tag = jsonTag{
|
||||
apiName: val[:i],
|
||||
}
|
||||
|
||||
switch val[i+1:] {
|
||||
case "omitempty":
|
||||
case "omitempty,string":
|
||||
tag.stringFormat = true
|
||||
default:
|
||||
return tag, fmt.Errorf("malformed json tag: %s", val)
|
||||
}
|
||||
|
||||
return tag, nil
|
||||
}
|
||||
|
||||
// Reports whether the struct field "f" with value "v" should be included in JSON output.
|
||||
func includeField(v reflect.Value, f reflect.StructField, mustInclude map[string]struct{}) bool {
|
||||
// The regular JSON encoding of a nil pointer is "null", which means "delete this field".
|
||||
// Therefore, we could enable field deletion by honoring pointer fields' presence in the mustInclude set.
|
||||
// However, many fields are not pointers, so there would be no way to delete these fields.
|
||||
// Rather than partially supporting field deletion, we ignore mustInclude for nil pointer fields.
|
||||
// Deletion will be handled by a separate mechanism.
|
||||
if f.Type.Kind() == reflect.Ptr && v.IsNil() {
|
||||
return false
|
||||
}
|
||||
|
||||
// The "any" type is represented as an interface{}. If this interface
|
||||
// is nil, there is no reasonable representation to send. We ignore
|
||||
// these fields, for the same reasons as given above for pointers.
|
||||
if f.Type.Kind() == reflect.Interface && v.IsNil() {
|
||||
return false
|
||||
}
|
||||
|
||||
_, ok := mustInclude[f.Name]
|
||||
return ok || !isEmptyValue(v)
|
||||
}
|
||||
|
||||
// isEmptyValue reports whether v is the empty value for its type. This
|
||||
// implementation is based on that of the encoding/json package, but its
|
||||
// correctness does not depend on it being identical. What's important is that
|
||||
// this function return false in situations where v should not be sent as part
|
||||
// of a PATCH operation.
|
||||
func isEmptyValue(v reflect.Value) bool {
|
||||
switch v.Kind() {
|
||||
case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
|
||||
return v.Len() == 0
|
||||
case reflect.Bool:
|
||||
return !v.Bool()
|
||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||
return v.Int() == 0
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
|
||||
return v.Uint() == 0
|
||||
case reflect.Float32, reflect.Float64:
|
||||
return v.Float() == 0
|
||||
case reflect.Interface, reflect.Ptr:
|
||||
return v.IsNil()
|
||||
}
|
||||
return false
|
||||
}
|
31
vendor/google.golang.org/api/gensupport/params.go
generated
vendored
31
vendor/google.golang.org/api/gensupport/params.go
generated
vendored
|
@ -1,31 +0,0 @@
|
|||
// 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 gensupport
|
||||
|
||||
import "net/url"
|
||||
|
||||
// URLParams is a simplified replacement for url.Values
|
||||
// that safely builds up URL parameters for encoding.
|
||||
type URLParams map[string][]string
|
||||
|
||||
// Set sets the key to value.
|
||||
// It replaces any existing values.
|
||||
func (u URLParams) Set(key, value string) {
|
||||
u[key] = []string{value}
|
||||
}
|
||||
|
||||
// SetMulti sets the key to an array of values.
|
||||
// It replaces any existing values.
|
||||
// Note that values must not be modified after calling SetMulti
|
||||
// so the caller is responsible for making a copy if necessary.
|
||||
func (u URLParams) SetMulti(key string, values []string) {
|
||||
u[key] = values
|
||||
}
|
||||
|
||||
// Encode encodes the values into ``URL encoded'' form
|
||||
// ("bar=baz&foo=quux") sorted by key.
|
||||
func (u URLParams) Encode() string {
|
||||
return url.Values(u).Encode()
|
||||
}
|
588
vendor/google.golang.org/api/googleapi/googleapi.go
generated
vendored
588
vendor/google.golang.org/api/googleapi/googleapi.go
generated
vendored
|
@ -1,588 +0,0 @@
|
|||
// Copyright 2011 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package googleapi contains the common code shared by all Google API
|
||||
// libraries.
|
||||
package googleapi // import "google.golang.org/api/googleapi"
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
"net/textproto"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/net/context/ctxhttp"
|
||||
"google.golang.org/api/googleapi/internal/uritemplates"
|
||||
)
|
||||
|
||||
// ContentTyper is an interface for Readers which know (or would like
|
||||
// to override) their Content-Type. If a media body doesn't implement
|
||||
// ContentTyper, the type is sniffed from the content using
|
||||
// http.DetectContentType.
|
||||
type ContentTyper interface {
|
||||
ContentType() string
|
||||
}
|
||||
|
||||
// A SizeReaderAt is a ReaderAt with a Size method.
|
||||
// An io.SectionReader implements SizeReaderAt.
|
||||
type SizeReaderAt interface {
|
||||
io.ReaderAt
|
||||
Size() int64
|
||||
}
|
||||
|
||||
// ServerResponse is embedded in each Do response and
|
||||
// provides the HTTP status code and header sent by the server.
|
||||
type ServerResponse struct {
|
||||
// HTTPStatusCode is the server's response status code.
|
||||
// When using a resource method's Do call, this will always be in the 2xx range.
|
||||
HTTPStatusCode int
|
||||
// Header contains the response header fields from the server.
|
||||
Header http.Header
|
||||
}
|
||||
|
||||
const (
|
||||
Version = "0.5"
|
||||
|
||||
// statusResumeIncomplete is the code returned by the Google uploader when the transfer is not yet complete.
|
||||
statusResumeIncomplete = 308
|
||||
|
||||
// UserAgent is the header string used to identify this package.
|
||||
UserAgent = "google-api-go-client/" + Version
|
||||
|
||||
// uploadPause determines the delay between failed upload attempts
|
||||
uploadPause = 1 * time.Second
|
||||
)
|
||||
|
||||
// Error contains an error response from the server.
|
||||
type Error struct {
|
||||
// Code is the HTTP response status code and will always be populated.
|
||||
Code int `json:"code"`
|
||||
// Message is the server response message and is only populated when
|
||||
// explicitly referenced by the JSON server response.
|
||||
Message string `json:"message"`
|
||||
// Body is the raw response returned by the server.
|
||||
// It is often but not always JSON, depending on how the request fails.
|
||||
Body string
|
||||
// Header contains the response header fields from the server.
|
||||
Header http.Header
|
||||
|
||||
Errors []ErrorItem
|
||||
}
|
||||
|
||||
// ErrorItem is a detailed error code & message from the Google API frontend.
|
||||
type ErrorItem struct {
|
||||
// Reason is the typed error code. For example: "some_example".
|
||||
Reason string `json:"reason"`
|
||||
// Message is the human-readable description of the error.
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
func (e *Error) Error() string {
|
||||
if len(e.Errors) == 0 && e.Message == "" {
|
||||
return fmt.Sprintf("googleapi: got HTTP response code %d with body: %v", e.Code, e.Body)
|
||||
}
|
||||
var buf bytes.Buffer
|
||||
fmt.Fprintf(&buf, "googleapi: Error %d: ", e.Code)
|
||||
if e.Message != "" {
|
||||
fmt.Fprintf(&buf, "%s", e.Message)
|
||||
}
|
||||
if len(e.Errors) == 0 {
|
||||
return strings.TrimSpace(buf.String())
|
||||
}
|
||||
if len(e.Errors) == 1 && e.Errors[0].Message == e.Message {
|
||||
fmt.Fprintf(&buf, ", %s", e.Errors[0].Reason)
|
||||
return buf.String()
|
||||
}
|
||||
fmt.Fprintln(&buf, "\nMore details:")
|
||||
for _, v := range e.Errors {
|
||||
fmt.Fprintf(&buf, "Reason: %s, Message: %s\n", v.Reason, v.Message)
|
||||
}
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
type errorReply struct {
|
||||
Error *Error `json:"error"`
|
||||
}
|
||||
|
||||
// CheckResponse returns an error (of type *Error) if the response
|
||||
// status code is not 2xx.
|
||||
func CheckResponse(res *http.Response) error {
|
||||
if res.StatusCode >= 200 && res.StatusCode <= 299 {
|
||||
return nil
|
||||
}
|
||||
slurp, err := ioutil.ReadAll(res.Body)
|
||||
if err == nil {
|
||||
jerr := new(errorReply)
|
||||
err = json.Unmarshal(slurp, jerr)
|
||||
if err == nil && jerr.Error != nil {
|
||||
if jerr.Error.Code == 0 {
|
||||
jerr.Error.Code = res.StatusCode
|
||||
}
|
||||
jerr.Error.Body = string(slurp)
|
||||
return jerr.Error
|
||||
}
|
||||
}
|
||||
return &Error{
|
||||
Code: res.StatusCode,
|
||||
Body: string(slurp),
|
||||
Header: res.Header,
|
||||
}
|
||||
}
|
||||
|
||||
// IsNotModified reports whether err is the result of the
|
||||
// server replying with http.StatusNotModified.
|
||||
// Such error values are sometimes returned by "Do" methods
|
||||
// on calls when If-None-Match is used.
|
||||
func IsNotModified(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
ae, ok := err.(*Error)
|
||||
return ok && ae.Code == http.StatusNotModified
|
||||
}
|
||||
|
||||
// CheckMediaResponse returns an error (of type *Error) if the response
|
||||
// status code is not 2xx. Unlike CheckResponse it does not assume the
|
||||
// body is a JSON error document.
|
||||
func CheckMediaResponse(res *http.Response) error {
|
||||
if res.StatusCode >= 200 && res.StatusCode <= 299 {
|
||||
return nil
|
||||
}
|
||||
slurp, _ := ioutil.ReadAll(io.LimitReader(res.Body, 1<<20))
|
||||
res.Body.Close()
|
||||
return &Error{
|
||||
Code: res.StatusCode,
|
||||
Body: string(slurp),
|
||||
}
|
||||
}
|
||||
|
||||
type MarshalStyle bool
|
||||
|
||||
var WithDataWrapper = MarshalStyle(true)
|
||||
var WithoutDataWrapper = MarshalStyle(false)
|
||||
|
||||
func (wrap MarshalStyle) JSONReader(v interface{}) (io.Reader, error) {
|
||||
buf := new(bytes.Buffer)
|
||||
if wrap {
|
||||
buf.Write([]byte(`{"data": `))
|
||||
}
|
||||
err := json.NewEncoder(buf).Encode(v)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if wrap {
|
||||
buf.Write([]byte(`}`))
|
||||
}
|
||||
return buf, nil
|
||||
}
|
||||
|
||||
func getMediaType(media io.Reader) (io.Reader, string) {
|
||||
if typer, ok := media.(ContentTyper); ok {
|
||||
return media, typer.ContentType()
|
||||
}
|
||||
|
||||
pr, pw := io.Pipe()
|
||||
typ := "application/octet-stream"
|
||||
buf, err := ioutil.ReadAll(io.LimitReader(media, 512))
|
||||
if err != nil {
|
||||
pw.CloseWithError(fmt.Errorf("error reading media: %v", err))
|
||||
return pr, typ
|
||||
}
|
||||
typ = http.DetectContentType(buf)
|
||||
mr := io.MultiReader(bytes.NewReader(buf), media)
|
||||
go func() {
|
||||
_, err = io.Copy(pw, mr)
|
||||
if err != nil {
|
||||
pw.CloseWithError(fmt.Errorf("error reading media: %v", err))
|
||||
return
|
||||
}
|
||||
pw.Close()
|
||||
}()
|
||||
return pr, typ
|
||||
}
|
||||
|
||||
// DetectMediaType detects and returns the content type of the provided media.
|
||||
// If the type can not be determined, "application/octet-stream" is returned.
|
||||
func DetectMediaType(media io.ReaderAt) string {
|
||||
if typer, ok := media.(ContentTyper); ok {
|
||||
return typer.ContentType()
|
||||
}
|
||||
|
||||
typ := "application/octet-stream"
|
||||
buf := make([]byte, 1024)
|
||||
n, err := media.ReadAt(buf, 0)
|
||||
buf = buf[:n]
|
||||
if err == nil || err == io.EOF {
|
||||
typ = http.DetectContentType(buf)
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
type Lengther interface {
|
||||
Len() int
|
||||
}
|
||||
|
||||
// endingWithErrorReader from r until it returns an error. If the
|
||||
// final error from r is io.EOF and e is non-nil, e is used instead.
|
||||
type endingWithErrorReader struct {
|
||||
r io.Reader
|
||||
e error
|
||||
}
|
||||
|
||||
func (er endingWithErrorReader) Read(p []byte) (n int, err error) {
|
||||
n, err = er.r.Read(p)
|
||||
if err == io.EOF && er.e != nil {
|
||||
err = er.e
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func typeHeader(contentType string) textproto.MIMEHeader {
|
||||
h := make(textproto.MIMEHeader)
|
||||
h.Set("Content-Type", contentType)
|
||||
return h
|
||||
}
|
||||
|
||||
// countingWriter counts the number of bytes it receives to write, but
|
||||
// discards them.
|
||||
type countingWriter struct {
|
||||
n *int64
|
||||
}
|
||||
|
||||
func (w countingWriter) Write(p []byte) (int, error) {
|
||||
*w.n += int64(len(p))
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
// ConditionallyIncludeMedia does nothing if media is nil.
|
||||
//
|
||||
// bodyp is an in/out parameter. It should initially point to the
|
||||
// reader of the application/json (or whatever) payload to send in the
|
||||
// API request. It's updated to point to the multipart body reader.
|
||||
//
|
||||
// ctypep is an in/out parameter. It should initially point to the
|
||||
// content type of the bodyp, usually "application/json". It's updated
|
||||
// to the "multipart/related" content type, with random boundary.
|
||||
//
|
||||
// The return value is the content-length of the entire multpart body.
|
||||
func ConditionallyIncludeMedia(media io.Reader, bodyp *io.Reader, ctypep *string) (cancel func(), ok bool) {
|
||||
if media == nil {
|
||||
return
|
||||
}
|
||||
// Get the media type, which might return a different reader instance.
|
||||
var mediaType string
|
||||
media, mediaType = getMediaType(media)
|
||||
|
||||
body, bodyType := *bodyp, *ctypep
|
||||
|
||||
pr, pw := io.Pipe()
|
||||
mpw := multipart.NewWriter(pw)
|
||||
*bodyp = pr
|
||||
*ctypep = "multipart/related; boundary=" + mpw.Boundary()
|
||||
go func() {
|
||||
w, err := mpw.CreatePart(typeHeader(bodyType))
|
||||
if err != nil {
|
||||
mpw.Close()
|
||||
pw.CloseWithError(fmt.Errorf("googleapi: body CreatePart failed: %v", err))
|
||||
return
|
||||
}
|
||||
_, err = io.Copy(w, body)
|
||||
if err != nil {
|
||||
mpw.Close()
|
||||
pw.CloseWithError(fmt.Errorf("googleapi: body Copy failed: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
w, err = mpw.CreatePart(typeHeader(mediaType))
|
||||
if err != nil {
|
||||
mpw.Close()
|
||||
pw.CloseWithError(fmt.Errorf("googleapi: media CreatePart failed: %v", err))
|
||||
return
|
||||
}
|
||||
_, err = io.Copy(w, media)
|
||||
if err != nil {
|
||||
mpw.Close()
|
||||
pw.CloseWithError(fmt.Errorf("googleapi: media Copy failed: %v", err))
|
||||
return
|
||||
}
|
||||
mpw.Close()
|
||||
pw.Close()
|
||||
}()
|
||||
cancel = func() { pw.CloseWithError(errAborted) }
|
||||
return cancel, true
|
||||
}
|
||||
|
||||
var errAborted = errors.New("googleapi: upload aborted")
|
||||
|
||||
// ProgressUpdater is a function that is called upon every progress update of a resumable upload.
|
||||
// This is the only part of a resumable upload (from googleapi) that is usable by the developer.
|
||||
// The remaining usable pieces of resumable uploads is exposed in each auto-generated API.
|
||||
type ProgressUpdater func(current, total int64)
|
||||
|
||||
// ResumableUpload is used by the generated APIs to provide resumable uploads.
|
||||
// It is not used by developers directly.
|
||||
type ResumableUpload struct {
|
||||
Client *http.Client
|
||||
// URI is the resumable resource destination provided by the server after specifying "&uploadType=resumable".
|
||||
URI string
|
||||
UserAgent string // User-Agent for header of the request
|
||||
// Media is the object being uploaded.
|
||||
Media io.ReaderAt
|
||||
// MediaType defines the media type, e.g. "image/jpeg".
|
||||
MediaType string
|
||||
// ContentLength is the full size of the object being uploaded.
|
||||
ContentLength int64
|
||||
|
||||
mu sync.Mutex // guards progress
|
||||
progress int64 // number of bytes uploaded so far
|
||||
|
||||
// Callback is an optional function that will be called upon every progress update.
|
||||
Callback ProgressUpdater
|
||||
}
|
||||
|
||||
var (
|
||||
// rangeRE matches the transfer status response from the server. $1 is the last byte index uploaded.
|
||||
rangeRE = regexp.MustCompile(`^bytes=0\-(\d+)$`)
|
||||
// chunkSize is the size of the chunks created during a resumable upload and should be a power of two.
|
||||
// 1<<18 is the minimum size supported by the Google uploader, and there is no maximum.
|
||||
chunkSize int64 = 1 << 18
|
||||
)
|
||||
|
||||
// Progress returns the number of bytes uploaded at this point.
|
||||
func (rx *ResumableUpload) Progress() int64 {
|
||||
rx.mu.Lock()
|
||||
defer rx.mu.Unlock()
|
||||
return rx.progress
|
||||
}
|
||||
|
||||
func (rx *ResumableUpload) transferStatus(ctx context.Context) (int64, *http.Response, error) {
|
||||
req, _ := http.NewRequest("POST", rx.URI, nil)
|
||||
req.ContentLength = 0
|
||||
req.Header.Set("User-Agent", rx.UserAgent)
|
||||
req.Header.Set("Content-Range", fmt.Sprintf("bytes */%v", rx.ContentLength))
|
||||
res, err := ctxhttp.Do(ctx, rx.Client, req)
|
||||
if err != nil || res.StatusCode != statusResumeIncomplete {
|
||||
return 0, res, err
|
||||
}
|
||||
var start int64
|
||||
if m := rangeRE.FindStringSubmatch(res.Header.Get("Range")); len(m) == 2 {
|
||||
start, err = strconv.ParseInt(m[1], 10, 64)
|
||||
if err != nil {
|
||||
return 0, nil, fmt.Errorf("unable to parse range size %v", m[1])
|
||||
}
|
||||
start += 1 // Start at the next byte
|
||||
}
|
||||
return start, res, nil
|
||||
}
|
||||
|
||||
type chunk struct {
|
||||
body io.Reader
|
||||
size int64
|
||||
err error
|
||||
}
|
||||
|
||||
func (rx *ResumableUpload) transferChunks(ctx context.Context) (*http.Response, error) {
|
||||
start, res, err := rx.transferStatus(ctx)
|
||||
if err != nil || res.StatusCode != statusResumeIncomplete {
|
||||
if err == context.Canceled {
|
||||
return &http.Response{StatusCode: http.StatusRequestTimeout}, err
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
|
||||
for {
|
||||
select { // Check for cancellation
|
||||
case <-ctx.Done():
|
||||
res.StatusCode = http.StatusRequestTimeout
|
||||
return res, ctx.Err()
|
||||
default:
|
||||
}
|
||||
reqSize := rx.ContentLength - start
|
||||
if reqSize > chunkSize {
|
||||
reqSize = chunkSize
|
||||
}
|
||||
r := io.NewSectionReader(rx.Media, start, reqSize)
|
||||
req, _ := http.NewRequest("POST", rx.URI, r)
|
||||
req.ContentLength = reqSize
|
||||
req.Header.Set("Content-Range", fmt.Sprintf("bytes %v-%v/%v", start, start+reqSize-1, rx.ContentLength))
|
||||
req.Header.Set("Content-Type", rx.MediaType)
|
||||
req.Header.Set("User-Agent", rx.UserAgent)
|
||||
res, err = ctxhttp.Do(ctx, rx.Client, req)
|
||||
start += reqSize
|
||||
if err == nil && (res.StatusCode == statusResumeIncomplete || res.StatusCode == http.StatusOK) {
|
||||
rx.mu.Lock()
|
||||
rx.progress = start // keep track of number of bytes sent so far
|
||||
rx.mu.Unlock()
|
||||
if rx.Callback != nil {
|
||||
rx.Callback(start, rx.ContentLength)
|
||||
}
|
||||
}
|
||||
if err != nil || res.StatusCode != statusResumeIncomplete {
|
||||
break
|
||||
}
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
|
||||
var sleep = time.Sleep // override in unit tests
|
||||
|
||||
// Upload starts the process of a resumable upload with a cancellable context.
|
||||
// It retries indefinitely (with a pause of uploadPause between attempts) until cancelled.
|
||||
// It is called from the auto-generated API code and is not visible to the user.
|
||||
// rx is private to the auto-generated API code.
|
||||
func (rx *ResumableUpload) Upload(ctx context.Context) (*http.Response, error) {
|
||||
var res *http.Response
|
||||
var err error
|
||||
for {
|
||||
res, err = rx.transferChunks(ctx)
|
||||
if err != nil || res.StatusCode == http.StatusCreated || res.StatusCode == http.StatusOK {
|
||||
return res, err
|
||||
}
|
||||
select { // Check for cancellation
|
||||
case <-ctx.Done():
|
||||
res.StatusCode = http.StatusRequestTimeout
|
||||
return res, ctx.Err()
|
||||
default:
|
||||
}
|
||||
sleep(uploadPause)
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
|
||||
func ResolveRelative(basestr, relstr string) string {
|
||||
u, _ := url.Parse(basestr)
|
||||
rel, _ := url.Parse(relstr)
|
||||
u = u.ResolveReference(rel)
|
||||
us := u.String()
|
||||
us = strings.Replace(us, "%7B", "{", -1)
|
||||
us = strings.Replace(us, "%7D", "}", -1)
|
||||
return us
|
||||
}
|
||||
|
||||
// has4860Fix is whether this Go environment contains the fix for
|
||||
// http://golang.org/issue/4860
|
||||
var has4860Fix bool
|
||||
|
||||
// init initializes has4860Fix by checking the behavior of the net/http package.
|
||||
func init() {
|
||||
r := http.Request{
|
||||
URL: &url.URL{
|
||||
Scheme: "http",
|
||||
Opaque: "//opaque",
|
||||
},
|
||||
}
|
||||
b := &bytes.Buffer{}
|
||||
r.Write(b)
|
||||
has4860Fix = bytes.HasPrefix(b.Bytes(), []byte("GET http"))
|
||||
}
|
||||
|
||||
// SetOpaque sets u.Opaque from u.Path such that HTTP requests to it
|
||||
// don't alter any hex-escaped characters in u.Path.
|
||||
func SetOpaque(u *url.URL) {
|
||||
u.Opaque = "//" + u.Host + u.Path
|
||||
if !has4860Fix {
|
||||
u.Opaque = u.Scheme + ":" + u.Opaque
|
||||
}
|
||||
}
|
||||
|
||||
// Expand subsitutes any {encoded} strings in the URL passed in using
|
||||
// the map supplied.
|
||||
//
|
||||
// This calls SetOpaque to avoid encoding of the parameters in the URL path.
|
||||
func Expand(u *url.URL, expansions map[string]string) {
|
||||
expanded, err := uritemplates.Expand(u.Path, expansions)
|
||||
if err == nil {
|
||||
u.Path = expanded
|
||||
SetOpaque(u)
|
||||
}
|
||||
}
|
||||
|
||||
// CloseBody is used to close res.Body.
|
||||
// Prior to calling Close, it also tries to Read a small amount to see an EOF.
|
||||
// Not seeing an EOF can prevent HTTP Transports from reusing connections.
|
||||
func CloseBody(res *http.Response) {
|
||||
if res == nil || res.Body == nil {
|
||||
return
|
||||
}
|
||||
// Justification for 3 byte reads: two for up to "\r\n" after
|
||||
// a JSON/XML document, and then 1 to see EOF if we haven't yet.
|
||||
// TODO(bradfitz): detect Go 1.3+ and skip these reads.
|
||||
// See https://codereview.appspot.com/58240043
|
||||
// and https://codereview.appspot.com/49570044
|
||||
buf := make([]byte, 1)
|
||||
for i := 0; i < 3; i++ {
|
||||
_, err := res.Body.Read(buf)
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
res.Body.Close()
|
||||
|
||||
}
|
||||
|
||||
// VariantType returns the type name of the given variant.
|
||||
// If the map doesn't contain the named key or the value is not a []interface{}, "" is returned.
|
||||
// This is used to support "variant" APIs that can return one of a number of different types.
|
||||
func VariantType(t map[string]interface{}) string {
|
||||
s, _ := t["type"].(string)
|
||||
return s
|
||||
}
|
||||
|
||||
// ConvertVariant uses the JSON encoder/decoder to fill in the struct 'dst' with the fields found in variant 'v'.
|
||||
// This is used to support "variant" APIs that can return one of a number of different types.
|
||||
// It reports whether the conversion was successful.
|
||||
func ConvertVariant(v map[string]interface{}, dst interface{}) bool {
|
||||
var buf bytes.Buffer
|
||||
err := json.NewEncoder(&buf).Encode(v)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return json.Unmarshal(buf.Bytes(), dst) == nil
|
||||
}
|
||||
|
||||
// A Field names a field to be retrieved with a partial response.
|
||||
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
|
||||
//
|
||||
// Partial responses can dramatically reduce the amount of data that must be sent to your application.
|
||||
// In order to request partial responses, you can specify the full list of fields
|
||||
// that your application needs by adding the Fields option to your request.
|
||||
//
|
||||
// Field strings use camelCase with leading lower-case characters to identify fields within the response.
|
||||
//
|
||||
// For example, if your response has a "NextPageToken" and a slice of "Items" with "Id" fields,
|
||||
// you could request just those fields like this:
|
||||
//
|
||||
// svc.Events.List().Fields("nextPageToken", "items/id").Do()
|
||||
//
|
||||
// or if you were also interested in each Item's "Updated" field, you can combine them like this:
|
||||
//
|
||||
// svc.Events.List().Fields("nextPageToken", "items(id,updated)").Do()
|
||||
//
|
||||
// More information about field formatting can be found here:
|
||||
// https://developers.google.com/+/api/#fields-syntax
|
||||
//
|
||||
// Another way to find field names is through the Google API explorer:
|
||||
// https://developers.google.com/apis-explorer/#p/
|
||||
type Field string
|
||||
|
||||
// CombineFields combines fields into a single string.
|
||||
func CombineFields(s []Field) string {
|
||||
r := make([]string, len(s))
|
||||
for i, v := range s {
|
||||
r[i] = string(v)
|
||||
}
|
||||
return strings.Join(r, ",")
|
||||
}
|
18
vendor/google.golang.org/api/googleapi/internal/uritemplates/LICENSE
generated
vendored
18
vendor/google.golang.org/api/googleapi/internal/uritemplates/LICENSE
generated
vendored
|
@ -1,18 +0,0 @@
|
|||
Copyright (c) 2013 Joshua Tacoma
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
359
vendor/google.golang.org/api/googleapi/internal/uritemplates/uritemplates.go
generated
vendored
359
vendor/google.golang.org/api/googleapi/internal/uritemplates/uritemplates.go
generated
vendored
|
@ -1,359 +0,0 @@
|
|||
// Copyright 2013 Joshua Tacoma. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package uritemplates is a level 4 implementation of RFC 6570 (URI
|
||||
// Template, http://tools.ietf.org/html/rfc6570).
|
||||
//
|
||||
// To use uritemplates, parse a template string and expand it with a value
|
||||
// map:
|
||||
//
|
||||
// template, _ := uritemplates.Parse("https://api.github.com/repos{/user,repo}")
|
||||
// values := make(map[string]interface{})
|
||||
// values["user"] = "jtacoma"
|
||||
// values["repo"] = "uritemplates"
|
||||
// expanded, _ := template.ExpandString(values)
|
||||
// fmt.Printf(expanded)
|
||||
//
|
||||
package uritemplates
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
unreserved = regexp.MustCompile("[^A-Za-z0-9\\-._~]")
|
||||
reserved = regexp.MustCompile("[^A-Za-z0-9\\-._~:/?#[\\]@!$&'()*+,;=]")
|
||||
validname = regexp.MustCompile("^([A-Za-z0-9_\\.]|%[0-9A-Fa-f][0-9A-Fa-f])+$")
|
||||
hex = []byte("0123456789ABCDEF")
|
||||
)
|
||||
|
||||
func pctEncode(src []byte) []byte {
|
||||
dst := make([]byte, len(src)*3)
|
||||
for i, b := range src {
|
||||
buf := dst[i*3 : i*3+3]
|
||||
buf[0] = 0x25
|
||||
buf[1] = hex[b/16]
|
||||
buf[2] = hex[b%16]
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
func escape(s string, allowReserved bool) (escaped string) {
|
||||
if allowReserved {
|
||||
escaped = string(reserved.ReplaceAllFunc([]byte(s), pctEncode))
|
||||
} else {
|
||||
escaped = string(unreserved.ReplaceAllFunc([]byte(s), pctEncode))
|
||||
}
|
||||
return escaped
|
||||
}
|
||||
|
||||
// A UriTemplate is a parsed representation of a URI template.
|
||||
type UriTemplate struct {
|
||||
raw string
|
||||
parts []templatePart
|
||||
}
|
||||
|
||||
// Parse parses a URI template string into a UriTemplate object.
|
||||
func Parse(rawtemplate string) (template *UriTemplate, err error) {
|
||||
template = new(UriTemplate)
|
||||
template.raw = rawtemplate
|
||||
split := strings.Split(rawtemplate, "{")
|
||||
template.parts = make([]templatePart, len(split)*2-1)
|
||||
for i, s := range split {
|
||||
if i == 0 {
|
||||
if strings.Contains(s, "}") {
|
||||
err = errors.New("unexpected }")
|
||||
break
|
||||
}
|
||||
template.parts[i].raw = s
|
||||
} else {
|
||||
subsplit := strings.Split(s, "}")
|
||||
if len(subsplit) != 2 {
|
||||
err = errors.New("malformed template")
|
||||
break
|
||||
}
|
||||
expression := subsplit[0]
|
||||
template.parts[i*2-1], err = parseExpression(expression)
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
template.parts[i*2].raw = subsplit[1]
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
template = nil
|
||||
}
|
||||
return template, err
|
||||
}
|
||||
|
||||
type templatePart struct {
|
||||
raw string
|
||||
terms []templateTerm
|
||||
first string
|
||||
sep string
|
||||
named bool
|
||||
ifemp string
|
||||
allowReserved bool
|
||||
}
|
||||
|
||||
type templateTerm struct {
|
||||
name string
|
||||
explode bool
|
||||
truncate int
|
||||
}
|
||||
|
||||
func parseExpression(expression string) (result templatePart, err error) {
|
||||
switch expression[0] {
|
||||
case '+':
|
||||
result.sep = ","
|
||||
result.allowReserved = true
|
||||
expression = expression[1:]
|
||||
case '.':
|
||||
result.first = "."
|
||||
result.sep = "."
|
||||
expression = expression[1:]
|
||||
case '/':
|
||||
result.first = "/"
|
||||
result.sep = "/"
|
||||
expression = expression[1:]
|
||||
case ';':
|
||||
result.first = ";"
|
||||
result.sep = ";"
|
||||
result.named = true
|
||||
expression = expression[1:]
|
||||
case '?':
|
||||
result.first = "?"
|
||||
result.sep = "&"
|
||||
result.named = true
|
||||
result.ifemp = "="
|
||||
expression = expression[1:]
|
||||
case '&':
|
||||
result.first = "&"
|
||||
result.sep = "&"
|
||||
result.named = true
|
||||
result.ifemp = "="
|
||||
expression = expression[1:]
|
||||
case '#':
|
||||
result.first = "#"
|
||||
result.sep = ","
|
||||
result.allowReserved = true
|
||||
expression = expression[1:]
|
||||
default:
|
||||
result.sep = ","
|
||||
}
|
||||
rawterms := strings.Split(expression, ",")
|
||||
result.terms = make([]templateTerm, len(rawterms))
|
||||
for i, raw := range rawterms {
|
||||
result.terms[i], err = parseTerm(raw)
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
|
||||
func parseTerm(term string) (result templateTerm, err error) {
|
||||
if strings.HasSuffix(term, "*") {
|
||||
result.explode = true
|
||||
term = term[:len(term)-1]
|
||||
}
|
||||
split := strings.Split(term, ":")
|
||||
if len(split) == 1 {
|
||||
result.name = term
|
||||
} else if len(split) == 2 {
|
||||
result.name = split[0]
|
||||
var parsed int64
|
||||
parsed, err = strconv.ParseInt(split[1], 10, 0)
|
||||
result.truncate = int(parsed)
|
||||
} else {
|
||||
err = errors.New("multiple colons in same term")
|
||||
}
|
||||
if !validname.MatchString(result.name) {
|
||||
err = errors.New("not a valid name: " + result.name)
|
||||
}
|
||||
if result.explode && result.truncate > 0 {
|
||||
err = errors.New("both explode and prefix modifers on same term")
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
|
||||
// Expand expands a URI template with a set of values to produce a string.
|
||||
func (self *UriTemplate) Expand(value interface{}) (string, error) {
|
||||
values, ismap := value.(map[string]interface{})
|
||||
if !ismap {
|
||||
if m, ismap := struct2map(value); !ismap {
|
||||
return "", errors.New("expected map[string]interface{}, struct, or pointer to struct.")
|
||||
} else {
|
||||
return self.Expand(m)
|
||||
}
|
||||
}
|
||||
var buf bytes.Buffer
|
||||
for _, p := range self.parts {
|
||||
err := p.expand(&buf, values)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
return buf.String(), nil
|
||||
}
|
||||
|
||||
func (self *templatePart) expand(buf *bytes.Buffer, values map[string]interface{}) error {
|
||||
if len(self.raw) > 0 {
|
||||
buf.WriteString(self.raw)
|
||||
return nil
|
||||
}
|
||||
var zeroLen = buf.Len()
|
||||
buf.WriteString(self.first)
|
||||
var firstLen = buf.Len()
|
||||
for _, term := range self.terms {
|
||||
value, exists := values[term.name]
|
||||
if !exists {
|
||||
continue
|
||||
}
|
||||
if buf.Len() != firstLen {
|
||||
buf.WriteString(self.sep)
|
||||
}
|
||||
switch v := value.(type) {
|
||||
case string:
|
||||
self.expandString(buf, term, v)
|
||||
case []interface{}:
|
||||
self.expandArray(buf, term, v)
|
||||
case map[string]interface{}:
|
||||
if term.truncate > 0 {
|
||||
return errors.New("cannot truncate a map expansion")
|
||||
}
|
||||
self.expandMap(buf, term, v)
|
||||
default:
|
||||
if m, ismap := struct2map(value); ismap {
|
||||
if term.truncate > 0 {
|
||||
return errors.New("cannot truncate a map expansion")
|
||||
}
|
||||
self.expandMap(buf, term, m)
|
||||
} else {
|
||||
str := fmt.Sprintf("%v", value)
|
||||
self.expandString(buf, term, str)
|
||||
}
|
||||
}
|
||||
}
|
||||
if buf.Len() == firstLen {
|
||||
original := buf.Bytes()[:zeroLen]
|
||||
buf.Reset()
|
||||
buf.Write(original)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *templatePart) expandName(buf *bytes.Buffer, name string, empty bool) {
|
||||
if self.named {
|
||||
buf.WriteString(name)
|
||||
if empty {
|
||||
buf.WriteString(self.ifemp)
|
||||
} else {
|
||||
buf.WriteString("=")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (self *templatePart) expandString(buf *bytes.Buffer, t templateTerm, s string) {
|
||||
if len(s) > t.truncate && t.truncate > 0 {
|
||||
s = s[:t.truncate]
|
||||
}
|
||||
self.expandName(buf, t.name, len(s) == 0)
|
||||
buf.WriteString(escape(s, self.allowReserved))
|
||||
}
|
||||
|
||||
func (self *templatePart) expandArray(buf *bytes.Buffer, t templateTerm, a []interface{}) {
|
||||
if len(a) == 0 {
|
||||
return
|
||||
} else if !t.explode {
|
||||
self.expandName(buf, t.name, false)
|
||||
}
|
||||
for i, value := range a {
|
||||
if t.explode && i > 0 {
|
||||
buf.WriteString(self.sep)
|
||||
} else if i > 0 {
|
||||
buf.WriteString(",")
|
||||
}
|
||||
var s string
|
||||
switch v := value.(type) {
|
||||
case string:
|
||||
s = v
|
||||
default:
|
||||
s = fmt.Sprintf("%v", v)
|
||||
}
|
||||
if len(s) > t.truncate && t.truncate > 0 {
|
||||
s = s[:t.truncate]
|
||||
}
|
||||
if self.named && t.explode {
|
||||
self.expandName(buf, t.name, len(s) == 0)
|
||||
}
|
||||
buf.WriteString(escape(s, self.allowReserved))
|
||||
}
|
||||
}
|
||||
|
||||
func (self *templatePart) expandMap(buf *bytes.Buffer, t templateTerm, m map[string]interface{}) {
|
||||
if len(m) == 0 {
|
||||
return
|
||||
}
|
||||
if !t.explode {
|
||||
self.expandName(buf, t.name, len(m) == 0)
|
||||
}
|
||||
var firstLen = buf.Len()
|
||||
for k, value := range m {
|
||||
if firstLen != buf.Len() {
|
||||
if t.explode {
|
||||
buf.WriteString(self.sep)
|
||||
} else {
|
||||
buf.WriteString(",")
|
||||
}
|
||||
}
|
||||
var s string
|
||||
switch v := value.(type) {
|
||||
case string:
|
||||
s = v
|
||||
default:
|
||||
s = fmt.Sprintf("%v", v)
|
||||
}
|
||||
if t.explode {
|
||||
buf.WriteString(escape(k, self.allowReserved))
|
||||
buf.WriteRune('=')
|
||||
buf.WriteString(escape(s, self.allowReserved))
|
||||
} else {
|
||||
buf.WriteString(escape(k, self.allowReserved))
|
||||
buf.WriteRune(',')
|
||||
buf.WriteString(escape(s, self.allowReserved))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func struct2map(v interface{}) (map[string]interface{}, bool) {
|
||||
value := reflect.ValueOf(v)
|
||||
switch value.Type().Kind() {
|
||||
case reflect.Ptr:
|
||||
return struct2map(value.Elem().Interface())
|
||||
case reflect.Struct:
|
||||
m := make(map[string]interface{})
|
||||
for i := 0; i < value.NumField(); i++ {
|
||||
tag := value.Type().Field(i).Tag
|
||||
var name string
|
||||
if strings.Contains(string(tag), ":") {
|
||||
name = tag.Get("uri")
|
||||
} else {
|
||||
name = strings.TrimSpace(string(tag))
|
||||
}
|
||||
if len(name) == 0 {
|
||||
name = value.Type().Field(i).Name
|
||||
}
|
||||
m[name] = value.Field(i).Interface()
|
||||
}
|
||||
return m, true
|
||||
}
|
||||
return nil, false
|
||||
}
|
13
vendor/google.golang.org/api/googleapi/internal/uritemplates/utils.go
generated
vendored
13
vendor/google.golang.org/api/googleapi/internal/uritemplates/utils.go
generated
vendored
|
@ -1,13 +0,0 @@
|
|||
package uritemplates
|
||||
|
||||
func Expand(path string, expansions map[string]string) (string, error) {
|
||||
template, err := Parse(path)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
values := make(map[string]interface{})
|
||||
for k, v := range expansions {
|
||||
values[k] = v
|
||||
}
|
||||
return template.Expand(values)
|
||||
}
|
38
vendor/google.golang.org/api/googleapi/transport/apikey.go
generated
vendored
Normal file
38
vendor/google.golang.org/api/googleapi/transport/apikey.go
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Copyright 2012 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package transport contains HTTP transports used to make
|
||||
// authenticated API requests.
|
||||
package transport
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// APIKey is an HTTP Transport which wraps an underlying transport and
|
||||
// appends an API Key "key" parameter to the URL of outgoing requests.
|
||||
type APIKey struct {
|
||||
// Key is the API Key to set on requests.
|
||||
Key string
|
||||
|
||||
// Transport is the underlying HTTP transport.
|
||||
// If nil, http.DefaultTransport is used.
|
||||
Transport http.RoundTripper
|
||||
}
|
||||
|
||||
func (t *APIKey) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
rt := t.Transport
|
||||
if rt == nil {
|
||||
rt = http.DefaultTransport
|
||||
if rt == nil {
|
||||
return nil, errors.New("googleapi/transport: no Transport specified or available")
|
||||
}
|
||||
}
|
||||
newReq := *req
|
||||
args := newReq.URL.Query()
|
||||
args.Set("key", t.Key)
|
||||
newReq.URL.RawQuery = args.Encode()
|
||||
return rt.RoundTrip(&newReq)
|
||||
}
|
182
vendor/google.golang.org/api/googleapi/types.go
generated
vendored
182
vendor/google.golang.org/api/googleapi/types.go
generated
vendored
|
@ -1,182 +0,0 @@
|
|||
// Copyright 2013 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package googleapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Int64s is a slice of int64s that marshal as quoted strings in JSON.
|
||||
type Int64s []int64
|
||||
|
||||
func (q *Int64s) UnmarshalJSON(raw []byte) error {
|
||||
*q = (*q)[:0]
|
||||
var ss []string
|
||||
if err := json.Unmarshal(raw, &ss); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, s := range ss {
|
||||
v, err := strconv.ParseInt(s, 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*q = append(*q, int64(v))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Int32s is a slice of int32s that marshal as quoted strings in JSON.
|
||||
type Int32s []int32
|
||||
|
||||
func (q *Int32s) UnmarshalJSON(raw []byte) error {
|
||||
*q = (*q)[:0]
|
||||
var ss []string
|
||||
if err := json.Unmarshal(raw, &ss); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, s := range ss {
|
||||
v, err := strconv.ParseInt(s, 10, 32)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*q = append(*q, int32(v))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Uint64s is a slice of uint64s that marshal as quoted strings in JSON.
|
||||
type Uint64s []uint64
|
||||
|
||||
func (q *Uint64s) UnmarshalJSON(raw []byte) error {
|
||||
*q = (*q)[:0]
|
||||
var ss []string
|
||||
if err := json.Unmarshal(raw, &ss); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, s := range ss {
|
||||
v, err := strconv.ParseUint(s, 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*q = append(*q, uint64(v))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Uint32s is a slice of uint32s that marshal as quoted strings in JSON.
|
||||
type Uint32s []uint32
|
||||
|
||||
func (q *Uint32s) UnmarshalJSON(raw []byte) error {
|
||||
*q = (*q)[:0]
|
||||
var ss []string
|
||||
if err := json.Unmarshal(raw, &ss); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, s := range ss {
|
||||
v, err := strconv.ParseUint(s, 10, 32)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*q = append(*q, uint32(v))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Float64s is a slice of float64s that marshal as quoted strings in JSON.
|
||||
type Float64s []float64
|
||||
|
||||
func (q *Float64s) UnmarshalJSON(raw []byte) error {
|
||||
*q = (*q)[:0]
|
||||
var ss []string
|
||||
if err := json.Unmarshal(raw, &ss); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, s := range ss {
|
||||
v, err := strconv.ParseFloat(s, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*q = append(*q, float64(v))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func quotedList(n int, fn func(dst []byte, i int) []byte) ([]byte, error) {
|
||||
dst := make([]byte, 0, 2+n*10) // somewhat arbitrary
|
||||
dst = append(dst, '[')
|
||||
for i := 0; i < n; i++ {
|
||||
if i > 0 {
|
||||
dst = append(dst, ',')
|
||||
}
|
||||
dst = append(dst, '"')
|
||||
dst = fn(dst, i)
|
||||
dst = append(dst, '"')
|
||||
}
|
||||
dst = append(dst, ']')
|
||||
return dst, nil
|
||||
}
|
||||
|
||||
func (s Int64s) MarshalJSON() ([]byte, error) {
|
||||
return quotedList(len(s), func(dst []byte, i int) []byte {
|
||||
return strconv.AppendInt(dst, s[i], 10)
|
||||
})
|
||||
}
|
||||
|
||||
func (s Int32s) MarshalJSON() ([]byte, error) {
|
||||
return quotedList(len(s), func(dst []byte, i int) []byte {
|
||||
return strconv.AppendInt(dst, int64(s[i]), 10)
|
||||
})
|
||||
}
|
||||
|
||||
func (s Uint64s) MarshalJSON() ([]byte, error) {
|
||||
return quotedList(len(s), func(dst []byte, i int) []byte {
|
||||
return strconv.AppendUint(dst, s[i], 10)
|
||||
})
|
||||
}
|
||||
|
||||
func (s Uint32s) MarshalJSON() ([]byte, error) {
|
||||
return quotedList(len(s), func(dst []byte, i int) []byte {
|
||||
return strconv.AppendUint(dst, uint64(s[i]), 10)
|
||||
})
|
||||
}
|
||||
|
||||
func (s Float64s) MarshalJSON() ([]byte, error) {
|
||||
return quotedList(len(s), func(dst []byte, i int) []byte {
|
||||
return strconv.AppendFloat(dst, s[i], 'g', -1, 64)
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper routines for simplifying the creation of optional fields of basic type.
|
||||
*/
|
||||
|
||||
// Bool is a helper routine that allocates a new bool value
|
||||
// to store v and returns a pointer to it.
|
||||
func Bool(v bool) *bool { return &v }
|
||||
|
||||
// Int32 is a helper routine that allocates a new int32 value
|
||||
// to store v and returns a pointer to it.
|
||||
func Int32(v int32) *int32 { return &v }
|
||||
|
||||
// Int64 is a helper routine that allocates a new int64 value
|
||||
// to store v and returns a pointer to it.
|
||||
func Int64(v int64) *int64 { return &v }
|
||||
|
||||
// Float64 is a helper routine that allocates a new float64 value
|
||||
// to store v and returns a pointer to it.
|
||||
func Float64(v float64) *float64 { return &v }
|
||||
|
||||
// Uint32 is a helper routine that allocates a new uint32 value
|
||||
// to store v and returns a pointer to it.
|
||||
func Uint32(v uint32) *uint32 { return &v }
|
||||
|
||||
// Uint64 is a helper routine that allocates a new uint64 value
|
||||
// to store v and returns a pointer to it.
|
||||
func Uint64(v uint64) *uint64 { return &v }
|
||||
|
||||
// String is a helper routine that allocates a new string value
|
||||
// to store v and returns a pointer to it.
|
||||
func String(v string) *string { return &v }
|
59
vendor/google.golang.org/api/internal/pool.go
generated
vendored
Normal file
59
vendor/google.golang.org/api/internal/pool.go
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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 internal
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"google.golang.org/grpc/naming"
|
||||
)
|
||||
|
||||
// PoolResolver provides a fixed list of addresses to load balance between
|
||||
// and does not provide further updates.
|
||||
type PoolResolver struct {
|
||||
poolSize int
|
||||
dialOpt *DialSettings
|
||||
ch chan []*naming.Update
|
||||
}
|
||||
|
||||
// NewPoolResolver returns a PoolResolver
|
||||
// This is an EXPERIMENTAL API and may be changed or removed in the future.
|
||||
func NewPoolResolver(size int, o *DialSettings) *PoolResolver {
|
||||
return &PoolResolver{poolSize: size, dialOpt: o}
|
||||
}
|
||||
|
||||
// Resolve returns a Watcher for the endpoint defined by the DialSettings
|
||||
// provided to NewPoolResolver.
|
||||
func (r *PoolResolver) Resolve(target string) (naming.Watcher, error) {
|
||||
if r.dialOpt.Endpoint == "" {
|
||||
return nil, errors.New("No endpoint configured")
|
||||
}
|
||||
addrs := make([]*naming.Update, 0, r.poolSize)
|
||||
for i := 0; i < r.poolSize; i++ {
|
||||
addrs = append(addrs, &naming.Update{Op: naming.Add, Addr: r.dialOpt.Endpoint, Metadata: i})
|
||||
}
|
||||
r.ch = make(chan []*naming.Update, 1)
|
||||
r.ch <- addrs
|
||||
return r, nil
|
||||
}
|
||||
|
||||
// Next returns a static list of updates on the first call,
|
||||
// and blocks indefinitely until Close is called on subsequent calls.
|
||||
func (r *PoolResolver) Next() ([]*naming.Update, error) {
|
||||
return <-r.ch, nil
|
||||
}
|
||||
|
||||
func (r *PoolResolver) Close() {
|
||||
close(r.ch)
|
||||
}
|
23
vendor/google.golang.org/api/internal/settings.go
generated
vendored
Normal file
23
vendor/google.golang.org/api/internal/settings.go
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Package internal supports the options and transport packages.
|
||||
package internal
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// DialSettings holds information needed to establish a connection with a
|
||||
// Google API service.
|
||||
type DialSettings struct {
|
||||
Endpoint string
|
||||
Scopes []string
|
||||
ServiceAccountJSONFilename string // if set, TokenSource is ignored.
|
||||
TokenSource oauth2.TokenSource
|
||||
UserAgent string
|
||||
APIKey string
|
||||
HTTPClient *http.Client
|
||||
GRPCDialOpts []grpc.DialOption
|
||||
GRPCConn *grpc.ClientConn
|
||||
}
|
231
vendor/google.golang.org/api/iterator/iterator.go
generated
vendored
Normal file
231
vendor/google.golang.org/api/iterator/iterator.go
generated
vendored
Normal file
|
@ -0,0 +1,231 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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 iterator provides support for standard Google API iterators.
|
||||
// See https://github.com/GoogleCloudPlatform/gcloud-golang/wiki/Iterator-Guidelines.
|
||||
package iterator
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
// Done is returned by an iterator's Next method when the iteration is
|
||||
// complete; when there are no more items to return.
|
||||
var Done = errors.New("no more items in iterator")
|
||||
|
||||
// We don't support mixed calls to Next and NextPage because they play
|
||||
// with the paging state in incompatible ways.
|
||||
var errMixed = errors.New("iterator: Next and NextPage called on same iterator")
|
||||
|
||||
// PageInfo contains information about an iterator's paging state.
|
||||
type PageInfo struct {
|
||||
// Token is the token used to retrieve the next page of items from the
|
||||
// API. You may set Token immediately after creating an iterator to
|
||||
// begin iteration at a particular point. If Token is the empty string,
|
||||
// the iterator will begin with the first eligible item.
|
||||
//
|
||||
// The result of setting Token after the first call to Next is undefined.
|
||||
//
|
||||
// After the underlying API method is called to retrieve a page of items,
|
||||
// Token is set to the next-page token in the response.
|
||||
Token string
|
||||
|
||||
// MaxSize is the maximum number of items returned by a call to the API.
|
||||
// Set MaxSize as a hint to optimize the buffering behavior of the iterator.
|
||||
// If zero, the page size is determined by the underlying service.
|
||||
//
|
||||
// Use Pager to retrieve a page of a specific, exact size.
|
||||
MaxSize int
|
||||
|
||||
// The error state of the iterator. Manipulated by PageInfo.next and Pager.
|
||||
// This is a latch: it starts as nil, and once set should never change.
|
||||
err error
|
||||
|
||||
// If true, no more calls to fetch should be made. Set to true when fetch
|
||||
// returns an empty page token. The iterator is Done when this is true AND
|
||||
// the buffer is empty.
|
||||
atEnd bool
|
||||
|
||||
// Function that fetches a page from the underlying service. It should pass
|
||||
// the pageSize and pageToken arguments to the service, fill the buffer
|
||||
// with the results from the call, and return the next-page token returned
|
||||
// by the service. The function must not remove any existing items from the
|
||||
// buffer. If the underlying RPC takes an int32 page size, pageSize should
|
||||
// be silently truncated.
|
||||
fetch func(pageSize int, pageToken string) (nextPageToken string, err error)
|
||||
|
||||
// Function that clears the iterator's buffer, returning any currently buffered items.
|
||||
bufLen func() int
|
||||
|
||||
// Function that returns the buffer, after setting the buffer variable to nil.
|
||||
takeBuf func() interface{}
|
||||
|
||||
// Set to true on first call to PageInfo.next or Pager.NextPage. Used to check
|
||||
// for calls to both Next and NextPage with the same iterator.
|
||||
nextCalled, nextPageCalled bool
|
||||
}
|
||||
|
||||
// NewPageInfo exposes internals for iterator implementations.
|
||||
// It is not a stable interface.
|
||||
var NewPageInfo = newPageInfo
|
||||
|
||||
// If an iterator can support paging, its iterator-creating method should call
|
||||
// this (via the NewPageInfo variable above).
|
||||
//
|
||||
// The fetch, bufLen and takeBuf arguments provide access to the
|
||||
// iterator's internal slice of buffered items. They behave as described in
|
||||
// PageInfo, above.
|
||||
//
|
||||
// The return value is the PageInfo.next method bound to the returned PageInfo value.
|
||||
// (Returning it avoids exporting PageInfo.next.)
|
||||
func newPageInfo(fetch func(int, string) (string, error), bufLen func() int, takeBuf func() interface{}) (*PageInfo, func() error) {
|
||||
pi := &PageInfo{
|
||||
fetch: fetch,
|
||||
bufLen: bufLen,
|
||||
takeBuf: takeBuf,
|
||||
}
|
||||
return pi, pi.next
|
||||
}
|
||||
|
||||
// Remaining returns the number of items available before the iterator makes another API call.
|
||||
func (pi *PageInfo) Remaining() int { return pi.bufLen() }
|
||||
|
||||
// next provides support for an iterator's Next function. An iterator's Next
|
||||
// should return the error returned by next if non-nil; else it can assume
|
||||
// there is at least one item in its buffer, and it should return that item and
|
||||
// remove it from the buffer.
|
||||
func (pi *PageInfo) next() error {
|
||||
pi.nextCalled = true
|
||||
if pi.err != nil { // Once we get an error, always return it.
|
||||
// TODO(jba): fix so users can retry on transient errors? Probably not worth it.
|
||||
return pi.err
|
||||
}
|
||||
if pi.nextPageCalled {
|
||||
pi.err = errMixed
|
||||
return pi.err
|
||||
}
|
||||
// Loop until we get some items or reach the end.
|
||||
for pi.bufLen() == 0 && !pi.atEnd {
|
||||
if err := pi.fill(pi.MaxSize); err != nil {
|
||||
pi.err = err
|
||||
return pi.err
|
||||
}
|
||||
if pi.Token == "" {
|
||||
pi.atEnd = true
|
||||
}
|
||||
}
|
||||
// Either the buffer is non-empty or pi.atEnd is true (or both).
|
||||
if pi.bufLen() == 0 {
|
||||
// The buffer is empty and pi.atEnd is true, i.e. the service has no
|
||||
// more items.
|
||||
pi.err = Done
|
||||
}
|
||||
return pi.err
|
||||
}
|
||||
|
||||
// Call the service to fill the buffer, using size and pi.Token. Set pi.Token to the
|
||||
// next-page token returned by the call.
|
||||
// If fill returns a non-nil error, the buffer will be empty.
|
||||
func (pi *PageInfo) fill(size int) error {
|
||||
tok, err := pi.fetch(size, pi.Token)
|
||||
if err != nil {
|
||||
pi.takeBuf() // clear the buffer
|
||||
return err
|
||||
}
|
||||
pi.Token = tok
|
||||
return nil
|
||||
}
|
||||
|
||||
// Pageable is implemented by iterators that support paging.
|
||||
type Pageable interface {
|
||||
// PageInfo returns paging information associated with the iterator.
|
||||
PageInfo() *PageInfo
|
||||
}
|
||||
|
||||
// Pager supports retrieving iterator items a page at a time.
|
||||
type Pager struct {
|
||||
pageInfo *PageInfo
|
||||
pageSize int
|
||||
}
|
||||
|
||||
// NewPager returns a pager that uses iter. Calls to its NextPage method will
|
||||
// obtain exactly pageSize items, unless fewer remain. The pageToken argument
|
||||
// indicates where to start the iteration. Pass the empty string to start at
|
||||
// the beginning, or pass a token retrieved from a call to Pager.NextPage.
|
||||
//
|
||||
// If you use an iterator with a Pager, you must not call Next on the iterator.
|
||||
func NewPager(iter Pageable, pageSize int, pageToken string) *Pager {
|
||||
p := &Pager{
|
||||
pageInfo: iter.PageInfo(),
|
||||
pageSize: pageSize,
|
||||
}
|
||||
p.pageInfo.Token = pageToken
|
||||
if pageSize <= 0 {
|
||||
p.pageInfo.err = errors.New("iterator: page size must be positive")
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
// NextPage retrieves a sequence of items from the iterator and appends them
|
||||
// to slicep, which must be a pointer to a slice of the iterator's item type.
|
||||
// Exactly p.pageSize items will be appended, unless fewer remain.
|
||||
//
|
||||
// The first return value is the page token to use for the next page of items.
|
||||
// If empty, there are no more pages. Aside from checking for the end of the
|
||||
// iteration, the returned page token is only needed if the iteration is to be
|
||||
// resumed a later time, in another context (possibly another process).
|
||||
//
|
||||
// The second return value is non-nil if an error occurred. It will never be
|
||||
// the special iterator sentinel value Done. To recognize the end of the
|
||||
// iteration, compare nextPageToken to the empty string.
|
||||
//
|
||||
// It is possible for NextPage to return a single zero-length page along with
|
||||
// an empty page token when there are no more items in the iteration.
|
||||
func (p *Pager) NextPage(slicep interface{}) (nextPageToken string, err error) {
|
||||
p.pageInfo.nextPageCalled = true
|
||||
if p.pageInfo.err != nil {
|
||||
return "", p.pageInfo.err
|
||||
}
|
||||
if p.pageInfo.nextCalled {
|
||||
p.pageInfo.err = errMixed
|
||||
return "", p.pageInfo.err
|
||||
}
|
||||
if p.pageInfo.bufLen() > 0 {
|
||||
return "", errors.New("must call NextPage with an empty buffer")
|
||||
}
|
||||
// The buffer must be empty here, so takeBuf is a no-op. We call it just to get
|
||||
// the buffer's type.
|
||||
wantSliceType := reflect.PtrTo(reflect.ValueOf(p.pageInfo.takeBuf()).Type())
|
||||
if slicep == nil {
|
||||
return "", errors.New("nil passed to Pager.NextPage")
|
||||
}
|
||||
vslicep := reflect.ValueOf(slicep)
|
||||
if vslicep.Type() != wantSliceType {
|
||||
return "", fmt.Errorf("slicep should be of type %s, got %T", wantSliceType, slicep)
|
||||
}
|
||||
for p.pageInfo.bufLen() < p.pageSize {
|
||||
if err := p.pageInfo.fill(p.pageSize - p.pageInfo.bufLen()); err != nil {
|
||||
p.pageInfo.err = err
|
||||
return "", p.pageInfo.err
|
||||
}
|
||||
if p.pageInfo.Token == "" {
|
||||
break
|
||||
}
|
||||
}
|
||||
e := vslicep.Elem()
|
||||
e.Set(reflect.AppendSlice(e, reflect.ValueOf(p.pageInfo.takeBuf())))
|
||||
return p.pageInfo.Token, nil
|
||||
}
|
4787
vendor/google.golang.org/api/logging/v1beta3/logging-gen.go
generated
vendored
4787
vendor/google.golang.org/api/logging/v1beta3/logging-gen.go
generated
vendored
File diff suppressed because it is too large
Load diff
142
vendor/google.golang.org/api/option/option.go
generated
vendored
Normal file
142
vendor/google.golang.org/api/option/option.go
generated
vendored
Normal file
|
@ -0,0 +1,142 @@
|
|||
// Package option contains options for Google API clients.
|
||||
package option
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
"google.golang.org/api/internal"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// A ClientOption is an option for a Google API client.
|
||||
type ClientOption interface {
|
||||
Apply(*internal.DialSettings)
|
||||
}
|
||||
|
||||
// WithTokenSource returns a ClientOption that specifies an OAuth2 token
|
||||
// source to be used as the basis for authentication.
|
||||
func WithTokenSource(s oauth2.TokenSource) ClientOption {
|
||||
return withTokenSource{s}
|
||||
}
|
||||
|
||||
type withTokenSource struct{ ts oauth2.TokenSource }
|
||||
|
||||
func (w withTokenSource) Apply(o *internal.DialSettings) {
|
||||
o.TokenSource = w.ts
|
||||
}
|
||||
|
||||
// WithServiceAccountFile returns a ClientOption that uses a Google service
|
||||
// account credentials file to authenticate.
|
||||
// Use WithTokenSource with a token source created from
|
||||
// golang.org/x/oauth2/google.JWTConfigFromJSON
|
||||
// if reading the file from disk is not an option.
|
||||
func WithServiceAccountFile(filename string) ClientOption {
|
||||
return withServiceAccountFile(filename)
|
||||
}
|
||||
|
||||
type withServiceAccountFile string
|
||||
|
||||
func (w withServiceAccountFile) Apply(o *internal.DialSettings) {
|
||||
o.ServiceAccountJSONFilename = string(w)
|
||||
}
|
||||
|
||||
// WithEndpoint returns a ClientOption that overrides the default endpoint
|
||||
// to be used for a service.
|
||||
func WithEndpoint(url string) ClientOption {
|
||||
return withEndpoint(url)
|
||||
}
|
||||
|
||||
type withEndpoint string
|
||||
|
||||
func (w withEndpoint) Apply(o *internal.DialSettings) {
|
||||
o.Endpoint = string(w)
|
||||
}
|
||||
|
||||
// WithScopes returns a ClientOption that overrides the default OAuth2 scopes
|
||||
// to be used for a service.
|
||||
func WithScopes(scope ...string) ClientOption {
|
||||
return withScopes(scope)
|
||||
}
|
||||
|
||||
type withScopes []string
|
||||
|
||||
func (w withScopes) Apply(o *internal.DialSettings) {
|
||||
s := make([]string, len(w))
|
||||
copy(s, w)
|
||||
o.Scopes = s
|
||||
}
|
||||
|
||||
// WithUserAgent returns a ClientOption that sets the User-Agent.
|
||||
func WithUserAgent(ua string) ClientOption {
|
||||
return withUA(ua)
|
||||
}
|
||||
|
||||
type withUA string
|
||||
|
||||
func (w withUA) Apply(o *internal.DialSettings) { o.UserAgent = string(w) }
|
||||
|
||||
// WithHTTPClient returns a ClientOption that specifies the HTTP client to use
|
||||
// as the basis of communications. This option may only be used with services
|
||||
// that support HTTP as their communication transport. When used, the
|
||||
// WithHTTPClient option takes precedent over all other supplied options.
|
||||
func WithHTTPClient(client *http.Client) ClientOption {
|
||||
return withHTTPClient{client}
|
||||
}
|
||||
|
||||
type withHTTPClient struct{ client *http.Client }
|
||||
|
||||
func (w withHTTPClient) Apply(o *internal.DialSettings) {
|
||||
o.HTTPClient = w.client
|
||||
}
|
||||
|
||||
// WithGRPCConn returns a ClientOption that specifies the gRPC client
|
||||
// connection to use as the basis of communications. This option many only be
|
||||
// used with services that support gRPC as their communication transport. When
|
||||
// used, the WithGRPCConn option takes precedent over all other supplied
|
||||
// options.
|
||||
func WithGRPCConn(conn *grpc.ClientConn) ClientOption {
|
||||
return withGRPCConn{conn}
|
||||
}
|
||||
|
||||
type withGRPCConn struct{ conn *grpc.ClientConn }
|
||||
|
||||
func (w withGRPCConn) Apply(o *internal.DialSettings) {
|
||||
o.GRPCConn = w.conn
|
||||
}
|
||||
|
||||
// WithGRPCDialOption returns a ClientOption that appends a new grpc.DialOption
|
||||
// to an underlying gRPC dial. It does not work with WithGRPCConn.
|
||||
func WithGRPCDialOption(opt grpc.DialOption) ClientOption {
|
||||
return withGRPCDialOption{opt}
|
||||
}
|
||||
|
||||
type withGRPCDialOption struct{ opt grpc.DialOption }
|
||||
|
||||
func (w withGRPCDialOption) Apply(o *internal.DialSettings) {
|
||||
o.GRPCDialOpts = append(o.GRPCDialOpts, w.opt)
|
||||
}
|
||||
|
||||
// WithGRPCConnectionPool returns a ClientOption that creates a pool of gRPC
|
||||
// connections that requests will be balanced between.
|
||||
// This is an EXPERIMENTAL API and may be changed or removed in the future.
|
||||
func WithGRPCConnectionPool(size int) ClientOption {
|
||||
return withGRPCConnectionPool(size)
|
||||
}
|
||||
|
||||
type withGRPCConnectionPool int
|
||||
|
||||
func (w withGRPCConnectionPool) Apply(o *internal.DialSettings) {
|
||||
balancer := grpc.RoundRobin(internal.NewPoolResolver(int(w), o))
|
||||
o.GRPCDialOpts = append(o.GRPCDialOpts, grpc.WithBalancer(balancer))
|
||||
}
|
||||
|
||||
// WithAPIKey returns a ClientOption that specifies an API key to be used
|
||||
// as the basis for authentication.
|
||||
func WithAPIKey(apiKey string) ClientOption {
|
||||
return withAPIKey(apiKey)
|
||||
}
|
||||
|
||||
type withAPIKey string
|
||||
|
||||
func (w withAPIKey) Apply(o *internal.DialSettings) { o.APIKey = string(w) }
|
261
vendor/google.golang.org/api/support/bundler/bundler.go
generated
vendored
Normal file
261
vendor/google.golang.org/api/support/bundler/bundler.go
generated
vendored
Normal file
|
@ -0,0 +1,261 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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 bundler supports bundling (batching) of items. Bundling amortizes an
|
||||
// action with fixed costs over multiple items. For example, if an API provides
|
||||
// an RPC that accepts a list of items as input, but clients would prefer
|
||||
// adding items one at a time, then a Bundler can accept individual items from
|
||||
// the client and bundle many of them into a single RPC.
|
||||
//
|
||||
// This package is experimental and subject to change without notice.
|
||||
package bundler
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"reflect"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultDelayThreshold = time.Second
|
||||
DefaultBundleCountThreshold = 10
|
||||
DefaultBundleByteThreshold = 1e6 // 1M
|
||||
DefaultBufferedByteLimit = 1e9 // 1G
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrOverflow indicates that Bundler's stored bytes exceeds its BufferedByteLimit.
|
||||
ErrOverflow = errors.New("bundler reached buffered byte limit")
|
||||
|
||||
// ErrOversizedItem indicates that an item's size exceeds the maximum bundle size.
|
||||
ErrOversizedItem = errors.New("item size exceeds bundle byte limit")
|
||||
)
|
||||
|
||||
// A Bundler collects items added to it into a bundle until the bundle
|
||||
// exceeds a given size, then calls a user-provided function to handle the bundle.
|
||||
type Bundler struct {
|
||||
// Starting from the time that the first message is added to a bundle, once
|
||||
// this delay has passed, handle the bundle. The default is DefaultDelayThreshold.
|
||||
DelayThreshold time.Duration
|
||||
|
||||
// Once a bundle has this many items, handle the bundle. Since only one
|
||||
// item at a time is added to a bundle, no bundle will exceed this
|
||||
// threshold, so it also serves as a limit. The default is
|
||||
// DefaultBundleCountThreshold.
|
||||
BundleCountThreshold int
|
||||
|
||||
// Once the number of bytes in current bundle reaches this threshold, handle
|
||||
// the bundle. The default is DefaultBundleByteThreshold. This triggers handling,
|
||||
// but does not cap the total size of a bundle.
|
||||
BundleByteThreshold int
|
||||
|
||||
// The maximum size of a bundle, in bytes. Zero means unlimited.
|
||||
BundleByteLimit int
|
||||
|
||||
// The maximum number of bytes that the Bundler will keep in memory before
|
||||
// returning ErrOverflow. The default is DefaultBufferedByteLimit.
|
||||
BufferedByteLimit int
|
||||
|
||||
handler func(interface{}) // called to handle a bundle
|
||||
itemSliceZero reflect.Value // nil (zero value) for slice of items
|
||||
donec chan struct{} // closed when the Bundler is closed
|
||||
handlec chan int // sent to when a bundle is ready for handling
|
||||
timer *time.Timer // implements DelayThreshold
|
||||
|
||||
mu sync.Mutex
|
||||
bufferedSize int // total bytes buffered
|
||||
closedBundles []bundle // bundles waiting to be handled
|
||||
curBundle bundle // incoming items added to this bundle
|
||||
calledc chan struct{} // closed and re-created after handler is called
|
||||
}
|
||||
|
||||
type bundle struct {
|
||||
items reflect.Value // slice of item type
|
||||
size int // size in bytes of all items
|
||||
}
|
||||
|
||||
// NewBundler creates a new Bundler. When you are finished with a Bundler, call
|
||||
// its Close method.
|
||||
//
|
||||
// itemExample is a value of the type that will be bundled. For example, if you
|
||||
// want to create bundles of *Entry, you could pass &Entry{} for itemExample.
|
||||
//
|
||||
// handler is a function that will be called on each bundle. If itemExample is
|
||||
// of type T, the argument to handler is of type []T. handler is always called
|
||||
// sequentially for each bundle, and never in parallel.
|
||||
func NewBundler(itemExample interface{}, handler func(interface{})) *Bundler {
|
||||
b := &Bundler{
|
||||
DelayThreshold: DefaultDelayThreshold,
|
||||
BundleCountThreshold: DefaultBundleCountThreshold,
|
||||
BundleByteThreshold: DefaultBundleByteThreshold,
|
||||
BufferedByteLimit: DefaultBufferedByteLimit,
|
||||
|
||||
handler: handler,
|
||||
itemSliceZero: reflect.Zero(reflect.SliceOf(reflect.TypeOf(itemExample))),
|
||||
donec: make(chan struct{}),
|
||||
handlec: make(chan int, 1),
|
||||
calledc: make(chan struct{}),
|
||||
timer: time.NewTimer(1000 * time.Hour), // harmless initial timeout
|
||||
}
|
||||
b.curBundle.items = b.itemSliceZero
|
||||
go b.background()
|
||||
return b
|
||||
}
|
||||
|
||||
// Add adds item to the current bundle. It marks the bundle for handling and
|
||||
// starts a new one if any of the thresholds or limits are exceeded.
|
||||
//
|
||||
// If the item's size exceeds the maximum bundle size (Bundler.BundleByteLimit), then
|
||||
// the item can never be handled. Add returns ErrOversizedItem in this case.
|
||||
//
|
||||
// If adding the item would exceed the maximum memory allowed (Bundler.BufferedByteLimit),
|
||||
// Add returns ErrOverflow.
|
||||
//
|
||||
// Add never blocks.
|
||||
func (b *Bundler) Add(item interface{}, size int) error {
|
||||
// If this item exceeds the maximum size of a bundle,
|
||||
// we can never send it.
|
||||
if b.BundleByteLimit > 0 && size > b.BundleByteLimit {
|
||||
return ErrOversizedItem
|
||||
}
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
// If adding this item would exceed our allotted memory
|
||||
// footprint, we can't accept it.
|
||||
if b.bufferedSize+size > b.BufferedByteLimit {
|
||||
return ErrOverflow
|
||||
}
|
||||
// If adding this item to the current bundle would cause it to exceed the
|
||||
// maximum bundle size, close the current bundle and start a new one.
|
||||
if b.BundleByteLimit > 0 && b.curBundle.size+size > b.BundleByteLimit {
|
||||
b.closeAndHandleBundle()
|
||||
}
|
||||
// Add the item.
|
||||
b.curBundle.items = reflect.Append(b.curBundle.items, reflect.ValueOf(item))
|
||||
b.curBundle.size += size
|
||||
b.bufferedSize += size
|
||||
// If this is the first item in the bundle, restart the timer.
|
||||
if b.curBundle.items.Len() == 1 {
|
||||
b.timer.Reset(b.DelayThreshold)
|
||||
}
|
||||
// If the current bundle equals the count threshold, close it.
|
||||
if b.curBundle.items.Len() == b.BundleCountThreshold {
|
||||
b.closeAndHandleBundle()
|
||||
}
|
||||
// If the current bundle equals or exceeds the byte threshold, close it.
|
||||
if b.curBundle.size >= b.BundleByteThreshold {
|
||||
b.closeAndHandleBundle()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Flush waits until all items in the Bundler have been handled (that is,
|
||||
// until the last invocation of handler has returned).
|
||||
func (b *Bundler) Flush() {
|
||||
b.mu.Lock()
|
||||
b.closeBundle()
|
||||
// Unconditionally trigger the handling goroutine, to ensure calledc is closed
|
||||
// even if there are no outstanding bundles.
|
||||
select {
|
||||
case b.handlec <- 1:
|
||||
default:
|
||||
}
|
||||
calledc := b.calledc // remember locally, because it may change
|
||||
b.mu.Unlock()
|
||||
<-calledc
|
||||
}
|
||||
|
||||
// Close calls Flush, then shuts down the Bundler. Close should always be
|
||||
// called on a Bundler when it is no longer needed. You must wait for all calls
|
||||
// to Add to complete before calling Close. Calling Add concurrently with Close
|
||||
// may result in the added items being ignored.
|
||||
func (b *Bundler) Close() {
|
||||
b.Flush()
|
||||
b.mu.Lock()
|
||||
b.timer.Stop()
|
||||
b.mu.Unlock()
|
||||
close(b.donec)
|
||||
}
|
||||
|
||||
func (b *Bundler) closeAndHandleBundle() {
|
||||
if b.closeBundle() {
|
||||
// We have created a closed bundle.
|
||||
// Send to handlec without blocking.
|
||||
select {
|
||||
case b.handlec <- 1:
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// closeBundle finishes the current bundle, adds it to the list of closed
|
||||
// bundles and informs the background goroutine that there are bundles ready
|
||||
// for processing.
|
||||
//
|
||||
// This should always be called with b.mu held.
|
||||
func (b *Bundler) closeBundle() bool {
|
||||
if b.curBundle.items.Len() == 0 {
|
||||
return false
|
||||
}
|
||||
b.closedBundles = append(b.closedBundles, b.curBundle)
|
||||
b.curBundle.items = b.itemSliceZero
|
||||
b.curBundle.size = 0
|
||||
return true
|
||||
}
|
||||
|
||||
// background runs in a separate goroutine, waiting for events and handling
|
||||
// bundles.
|
||||
func (b *Bundler) background() {
|
||||
done := false
|
||||
for {
|
||||
timedOut := false
|
||||
// Wait for something to happen.
|
||||
select {
|
||||
case <-b.handlec:
|
||||
case <-b.donec:
|
||||
done = true
|
||||
case <-b.timer.C:
|
||||
timedOut = true
|
||||
}
|
||||
// Handle closed bundles.
|
||||
b.mu.Lock()
|
||||
if timedOut {
|
||||
b.closeBundle()
|
||||
}
|
||||
buns := b.closedBundles
|
||||
b.closedBundles = nil
|
||||
// Closing calledc means we've sent all bundles. We need
|
||||
// a new channel for the next set of bundles, which may start
|
||||
// accumulating as soon as we release the lock.
|
||||
calledc := b.calledc
|
||||
b.calledc = make(chan struct{})
|
||||
b.mu.Unlock()
|
||||
for i, bun := range buns {
|
||||
b.handler(bun.items.Interface())
|
||||
// Drop the bundle's items, reducing our memory footprint.
|
||||
buns[i].items = reflect.Value{} // buns[i] because bun is a copy
|
||||
// Note immediately that we have more space, so Adds that occur
|
||||
// during this loop will have a chance of succeeding.
|
||||
b.mu.Lock()
|
||||
b.bufferedSize -= bun.size
|
||||
b.mu.Unlock()
|
||||
}
|
||||
// Signal that we've sent all outstanding bundles.
|
||||
close(calledc)
|
||||
if done {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
134
vendor/google.golang.org/api/transport/dial.go
generated
vendored
Normal file
134
vendor/google.golang.org/api/transport/dial.go
generated
vendored
Normal file
|
@ -0,0 +1,134 @@
|
|||
// Copyright 2015 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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 transport supports network connections to HTTP and GRPC servers.
|
||||
// This package is not intended for use by end developers. Use the
|
||||
// google.golang.org/api/option package to configure API clients.
|
||||
package transport
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/oauth2"
|
||||
"golang.org/x/oauth2/google"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/grpc/credentials/oauth"
|
||||
|
||||
gtransport "google.golang.org/api/googleapi/transport"
|
||||
"google.golang.org/api/internal"
|
||||
"google.golang.org/api/option"
|
||||
)
|
||||
|
||||
// NewHTTPClient returns an HTTP client for use communicating with a Google cloud
|
||||
// service, configured with the given ClientOptions. It also returns the endpoint
|
||||
// for the service as specified in the options.
|
||||
func NewHTTPClient(ctx context.Context, opts ...option.ClientOption) (*http.Client, string, error) {
|
||||
var o internal.DialSettings
|
||||
for _, opt := range opts {
|
||||
opt.Apply(&o)
|
||||
}
|
||||
if o.GRPCConn != nil {
|
||||
return nil, "", errors.New("unsupported gRPC connection specified")
|
||||
}
|
||||
// TODO(djd): Set UserAgent on all outgoing requests.
|
||||
if o.HTTPClient != nil {
|
||||
return o.HTTPClient, o.Endpoint, nil
|
||||
}
|
||||
if o.APIKey != "" {
|
||||
hc := &http.Client{
|
||||
Transport: >ransport.APIKey{
|
||||
Key: o.APIKey,
|
||||
Transport: http.DefaultTransport,
|
||||
},
|
||||
}
|
||||
return hc, o.Endpoint, nil
|
||||
}
|
||||
if o.ServiceAccountJSONFilename != "" {
|
||||
ts, err := serviceAcctTokenSource(ctx, o.ServiceAccountJSONFilename, o.Scopes...)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
o.TokenSource = ts
|
||||
}
|
||||
if o.TokenSource == nil {
|
||||
var err error
|
||||
o.TokenSource, err = google.DefaultTokenSource(ctx, o.Scopes...)
|
||||
if err != nil {
|
||||
return nil, "", fmt.Errorf("google.DefaultTokenSource: %v", err)
|
||||
}
|
||||
}
|
||||
return oauth2.NewClient(ctx, o.TokenSource), o.Endpoint, nil
|
||||
}
|
||||
|
||||
// Set at init time by dial_appengine.go. If nil, we're not on App Engine.
|
||||
var appengineDialerHook func(context.Context) grpc.DialOption
|
||||
|
||||
// DialGRPC returns a GRPC connection for use communicating with a Google cloud
|
||||
// service, configured with the given ClientOptions.
|
||||
func DialGRPC(ctx context.Context, opts ...option.ClientOption) (*grpc.ClientConn, error) {
|
||||
var o internal.DialSettings
|
||||
for _, opt := range opts {
|
||||
opt.Apply(&o)
|
||||
}
|
||||
if o.HTTPClient != nil {
|
||||
return nil, errors.New("unsupported HTTP client specified")
|
||||
}
|
||||
if o.GRPCConn != nil {
|
||||
return o.GRPCConn, nil
|
||||
}
|
||||
if o.ServiceAccountJSONFilename != "" {
|
||||
ts, err := serviceAcctTokenSource(ctx, o.ServiceAccountJSONFilename, o.Scopes...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
o.TokenSource = ts
|
||||
}
|
||||
if o.TokenSource == nil {
|
||||
var err error
|
||||
o.TokenSource, err = google.DefaultTokenSource(ctx, o.Scopes...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("google.DefaultTokenSource: %v", err)
|
||||
}
|
||||
}
|
||||
grpcOpts := []grpc.DialOption{
|
||||
grpc.WithPerRPCCredentials(oauth.TokenSource{o.TokenSource}),
|
||||
grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, "")),
|
||||
}
|
||||
if appengineDialerHook != nil {
|
||||
// Use the Socket API on App Engine.
|
||||
grpcOpts = append(grpcOpts, appengineDialerHook(ctx))
|
||||
}
|
||||
grpcOpts = append(grpcOpts, o.GRPCDialOpts...)
|
||||
if o.UserAgent != "" {
|
||||
grpcOpts = append(grpcOpts, grpc.WithUserAgent(o.UserAgent))
|
||||
}
|
||||
return grpc.DialContext(ctx, o.Endpoint, grpcOpts...)
|
||||
}
|
||||
|
||||
func serviceAcctTokenSource(ctx context.Context, filename string, scope ...string) (oauth2.TokenSource, error) {
|
||||
data, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot read service account file: %v", err)
|
||||
}
|
||||
cfg, err := google.JWTConfigFromJSON(data, scope...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("google.JWTConfigFromJSON: %v", err)
|
||||
}
|
||||
return cfg.TokenSource(ctx), nil
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2015 Google Inc. All Rights Reserved.
|
||||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -12,20 +12,23 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// +build !go1.5
|
||||
// +build appengine
|
||||
|
||||
package transport
|
||||
|
||||
import "net/http"
|
||||
import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
// makeReqCancel returns a closure that cancels the given http.Request
|
||||
// when called.
|
||||
func makeReqCancel(req *http.Request) func(http.RoundTripper) {
|
||||
// Go 1.4 and prior do not have a reliable way of cancelling a request.
|
||||
// Transport.CancelRequest will only work if the request is already in-flight.
|
||||
return func(r http.RoundTripper) {
|
||||
if t, ok := r.(*http.Transport); ok {
|
||||
t.CancelRequest(req)
|
||||
}
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/appengine/socket"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func init() {
|
||||
appengineDialerHook = func(ctx context.Context) grpc.DialOption {
|
||||
return grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
|
||||
return socket.DialTimeout(ctx, "tcp", addr, timeout)
|
||||
})
|
||||
}
|
||||
}
|
49
vendor/google.golang.org/cloud/cloud.go
generated
vendored
49
vendor/google.golang.org/cloud/cloud.go
generated
vendored
|
@ -1,49 +0,0 @@
|
|||
// Copyright 2014 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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 cloud contains Google Cloud Platform APIs related types
|
||||
// and common functions.
|
||||
package cloud // import "google.golang.org/cloud"
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/cloud/internal"
|
||||
)
|
||||
|
||||
// NewContext returns a new context that uses the provided http.Client.
|
||||
// Provided http.Client is responsible to authorize and authenticate
|
||||
// the requests made to the Google Cloud APIs.
|
||||
// It mutates the client's original Transport to append the cloud
|
||||
// package's user-agent to the outgoing requests.
|
||||
// You can obtain the project ID from the Google Developers Console,
|
||||
// https://console.developers.google.com.
|
||||
func NewContext(projID string, c *http.Client) context.Context {
|
||||
if c == nil {
|
||||
panic("invalid nil *http.Client passed to NewContext")
|
||||
}
|
||||
return WithContext(context.Background(), projID, c)
|
||||
}
|
||||
|
||||
// WithContext returns a new context in a similar way NewContext does,
|
||||
// but initiates the new context with the specified parent.
|
||||
func WithContext(parent context.Context, projID string, c *http.Client) context.Context {
|
||||
// TODO(bradfitz): delete internal.Transport. It's too wrappy for what it does.
|
||||
// Do User-Agent some other way.
|
||||
if _, ok := c.Transport.(*internal.Transport); !ok {
|
||||
c.Transport = &internal.Transport{Base: c.Transport}
|
||||
}
|
||||
return internal.WithContext(parent, projID, c)
|
||||
}
|
128
vendor/google.golang.org/cloud/internal/cloud.go
generated
vendored
128
vendor/google.golang.org/cloud/internal/cloud.go
generated
vendored
|
@ -1,128 +0,0 @@
|
|||
// Copyright 2014 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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 internal provides support for the cloud packages.
|
||||
//
|
||||
// Users should not import this package directly.
|
||||
package internal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"sync"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
type contextKey struct{}
|
||||
|
||||
func WithContext(parent context.Context, projID string, c *http.Client) context.Context {
|
||||
if c == nil {
|
||||
panic("nil *http.Client passed to WithContext")
|
||||
}
|
||||
if projID == "" {
|
||||
panic("empty project ID passed to WithContext")
|
||||
}
|
||||
return context.WithValue(parent, contextKey{}, &cloudContext{
|
||||
ProjectID: projID,
|
||||
HTTPClient: c,
|
||||
})
|
||||
}
|
||||
|
||||
const userAgent = "gcloud-golang/0.1"
|
||||
|
||||
type cloudContext struct {
|
||||
ProjectID string
|
||||
HTTPClient *http.Client
|
||||
|
||||
mu sync.Mutex // guards svc
|
||||
svc map[string]interface{} // e.g. "storage" => *rawStorage.Service
|
||||
}
|
||||
|
||||
// Service returns the result of the fill function if it's never been
|
||||
// called before for the given name (which is assumed to be an API
|
||||
// service name, like "datastore"). If it has already been cached, the fill
|
||||
// func is not run.
|
||||
// It's safe for concurrent use by multiple goroutines.
|
||||
func Service(ctx context.Context, name string, fill func(*http.Client) interface{}) interface{} {
|
||||
return cc(ctx).service(name, fill)
|
||||
}
|
||||
|
||||
func (c *cloudContext) service(name string, fill func(*http.Client) interface{}) interface{} {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
|
||||
if c.svc == nil {
|
||||
c.svc = make(map[string]interface{})
|
||||
} else if v, ok := c.svc[name]; ok {
|
||||
return v
|
||||
}
|
||||
v := fill(c.HTTPClient)
|
||||
c.svc[name] = v
|
||||
return v
|
||||
}
|
||||
|
||||
// Transport is an http.RoundTripper that appends
|
||||
// Google Cloud client's user-agent to the original
|
||||
// request's user-agent header.
|
||||
type Transport struct {
|
||||
// Base represents the actual http.RoundTripper
|
||||
// the requests will be delegated to.
|
||||
Base http.RoundTripper
|
||||
}
|
||||
|
||||
// RoundTrip appends a user-agent to the existing user-agent
|
||||
// header and delegates the request to the base http.RoundTripper.
|
||||
func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
req = cloneRequest(req)
|
||||
ua := req.Header.Get("User-Agent")
|
||||
if ua == "" {
|
||||
ua = userAgent
|
||||
} else {
|
||||
ua = fmt.Sprintf("%s %s", ua, userAgent)
|
||||
}
|
||||
req.Header.Set("User-Agent", ua)
|
||||
return t.Base.RoundTrip(req)
|
||||
}
|
||||
|
||||
// cloneRequest returns a clone of the provided *http.Request.
|
||||
// The clone is a shallow copy of the struct and its Header map.
|
||||
func cloneRequest(r *http.Request) *http.Request {
|
||||
// shallow copy of the struct
|
||||
r2 := new(http.Request)
|
||||
*r2 = *r
|
||||
// deep copy of the Header
|
||||
r2.Header = make(http.Header)
|
||||
for k, s := range r.Header {
|
||||
r2.Header[k] = s
|
||||
}
|
||||
return r2
|
||||
}
|
||||
|
||||
func ProjID(ctx context.Context) string {
|
||||
return cc(ctx).ProjectID
|
||||
}
|
||||
|
||||
func HTTPClient(ctx context.Context) *http.Client {
|
||||
return cc(ctx).HTTPClient
|
||||
}
|
||||
|
||||
// cc returns the internal *cloudContext (cc) state for a context.Context.
|
||||
// It panics if the user did it wrong.
|
||||
func cc(ctx context.Context) *cloudContext {
|
||||
if c, ok := ctx.Value(contextKey{}).(*cloudContext); ok {
|
||||
return c
|
||||
}
|
||||
panic("invalid context.Context type; it should be created with cloud.NewContext")
|
||||
}
|
24
vendor/google.golang.org/cloud/internal/opts/option.go
generated
vendored
24
vendor/google.golang.org/cloud/internal/opts/option.go
generated
vendored
|
@ -1,24 +0,0 @@
|
|||
// Package opts holds the DialOpts struct, configurable by
|
||||
// cloud.ClientOptions to set up transports for cloud packages.
|
||||
//
|
||||
// This is a separate page to prevent cycles between the core
|
||||
// cloud packages.
|
||||
package opts
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type DialOpt struct {
|
||||
Endpoint string
|
||||
Scopes []string
|
||||
UserAgent string
|
||||
|
||||
TokenSource oauth2.TokenSource
|
||||
|
||||
HTTPClient *http.Client
|
||||
GRPCClient *grpc.ClientConn
|
||||
}
|
134
vendor/google.golang.org/cloud/internal/transport/dial.go
generated
vendored
134
vendor/google.golang.org/cloud/internal/transport/dial.go
generated
vendored
|
@ -1,134 +0,0 @@
|
|||
// Copyright 2015 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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 transport
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/oauth2"
|
||||
"golang.org/x/oauth2/google"
|
||||
"google.golang.org/cloud"
|
||||
"google.golang.org/cloud/internal/opts"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/grpc/credentials/oauth"
|
||||
)
|
||||
|
||||
// ErrHTTP is returned when on a non-200 HTTP response.
|
||||
type ErrHTTP struct {
|
||||
StatusCode int
|
||||
Body []byte
|
||||
err error
|
||||
}
|
||||
|
||||
func (e *ErrHTTP) Error() string {
|
||||
if e.err == nil {
|
||||
return fmt.Sprintf("error during call, http status code: %v %s", e.StatusCode, e.Body)
|
||||
}
|
||||
return e.err.Error()
|
||||
}
|
||||
|
||||
// NewHTTPClient returns an HTTP client for use communicating with a Google cloud
|
||||
// service, configured with the given ClientOptions. It also returns the endpoint
|
||||
// for the service as specified in the options.
|
||||
func NewHTTPClient(ctx context.Context, opt ...cloud.ClientOption) (*http.Client, string, error) {
|
||||
var o opts.DialOpt
|
||||
for _, opt := range opt {
|
||||
opt.Resolve(&o)
|
||||
}
|
||||
if o.GRPCClient != nil {
|
||||
return nil, "", errors.New("unsupported GRPC base transport specified")
|
||||
}
|
||||
// TODO(djd): Wrap all http.Clients with appropriate internal version to add
|
||||
// UserAgent header and prepend correct endpoint.
|
||||
if o.HTTPClient != nil {
|
||||
return o.HTTPClient, o.Endpoint, nil
|
||||
}
|
||||
if o.TokenSource == nil {
|
||||
var err error
|
||||
o.TokenSource, err = google.DefaultTokenSource(ctx, o.Scopes...)
|
||||
if err != nil {
|
||||
return nil, "", fmt.Errorf("google.DefaultTokenSource: %v", err)
|
||||
}
|
||||
}
|
||||
return oauth2.NewClient(ctx, o.TokenSource), o.Endpoint, nil
|
||||
}
|
||||
|
||||
// NewProtoClient returns a ProtoClient for communicating with a Google cloud service,
|
||||
// configured with the given ClientOptions.
|
||||
func NewProtoClient(ctx context.Context, opt ...cloud.ClientOption) (*ProtoClient, error) {
|
||||
var o opts.DialOpt
|
||||
for _, opt := range opt {
|
||||
opt.Resolve(&o)
|
||||
}
|
||||
if o.GRPCClient != nil {
|
||||
return nil, errors.New("unsupported GRPC base transport specified")
|
||||
}
|
||||
var client *http.Client
|
||||
switch {
|
||||
case o.HTTPClient != nil:
|
||||
if o.TokenSource != nil {
|
||||
return nil, errors.New("at most one of WithTokenSource or WithBaseHTTP may be provided")
|
||||
}
|
||||
client = o.HTTPClient
|
||||
case o.TokenSource != nil:
|
||||
client = oauth2.NewClient(ctx, o.TokenSource)
|
||||
default:
|
||||
var err error
|
||||
client, err = google.DefaultClient(ctx, o.Scopes...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &ProtoClient{
|
||||
client: client,
|
||||
endpoint: o.Endpoint,
|
||||
userAgent: o.UserAgent,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// DialGRPC returns a GRPC connection for use communicating with a Google cloud
|
||||
// service, configured with the given ClientOptions.
|
||||
func DialGRPC(ctx context.Context, opt ...cloud.ClientOption) (*grpc.ClientConn, error) {
|
||||
var o opts.DialOpt
|
||||
for _, opt := range opt {
|
||||
opt.Resolve(&o)
|
||||
}
|
||||
if o.HTTPClient != nil {
|
||||
return nil, errors.New("unsupported HTTP base transport specified")
|
||||
}
|
||||
if o.GRPCClient != nil {
|
||||
return o.GRPCClient, nil
|
||||
}
|
||||
if o.TokenSource == nil {
|
||||
var err error
|
||||
o.TokenSource, err = google.DefaultTokenSource(ctx, o.Scopes...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("google.DefaultTokenSource: %v", err)
|
||||
}
|
||||
}
|
||||
grpcOpts := []grpc.DialOption{
|
||||
grpc.WithPerRPCCredentials(oauth.TokenSource{o.TokenSource}),
|
||||
grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, "")),
|
||||
}
|
||||
if o.UserAgent != "" {
|
||||
grpcOpts = append(grpcOpts, grpc.WithUserAgent(o.UserAgent))
|
||||
}
|
||||
return grpc.Dial(o.Endpoint, grpcOpts...)
|
||||
}
|
80
vendor/google.golang.org/cloud/internal/transport/proto.go
generated
vendored
80
vendor/google.golang.org/cloud/internal/transport/proto.go
generated
vendored
|
@ -1,80 +0,0 @@
|
|||
// Copyright 2015 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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 transport
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
type ProtoClient struct {
|
||||
client *http.Client
|
||||
endpoint string
|
||||
userAgent string
|
||||
}
|
||||
|
||||
func (c *ProtoClient) Call(ctx context.Context, method string, req, resp proto.Message) error {
|
||||
payload, err := proto.Marshal(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
httpReq, err := http.NewRequest("POST", c.endpoint+method, bytes.NewReader(payload))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
httpReq.Header.Set("Content-Type", "application/x-protobuf")
|
||||
if ua := c.userAgent; ua != "" {
|
||||
httpReq.Header.Set("User-Agent", ua)
|
||||
}
|
||||
|
||||
errc := make(chan error, 1)
|
||||
cancel := makeReqCancel(httpReq)
|
||||
|
||||
go func() {
|
||||
r, err := c.client.Do(httpReq)
|
||||
if err != nil {
|
||||
errc <- err
|
||||
return
|
||||
}
|
||||
defer r.Body.Close()
|
||||
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
if r.StatusCode != http.StatusOK {
|
||||
err = &ErrHTTP{
|
||||
StatusCode: r.StatusCode,
|
||||
Body: body,
|
||||
err: err,
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
errc <- err
|
||||
return
|
||||
}
|
||||
errc <- proto.Unmarshal(body, resp)
|
||||
}()
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
cancel(c.client.Transport) // Cancel the HTTP request.
|
||||
return ctx.Err()
|
||||
case err := <-errc:
|
||||
return err
|
||||
}
|
||||
}
|
468
vendor/google.golang.org/cloud/logging/logging.go
generated
vendored
468
vendor/google.golang.org/cloud/logging/logging.go
generated
vendored
|
@ -1,468 +0,0 @@
|
|||
// Copyright 2015 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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 logging contains a Google Cloud Logging client.
|
||||
//
|
||||
// This package is experimental and subject to API changes.
|
||||
package logging // import "google.golang.org/cloud/logging"
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"log"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
api "google.golang.org/api/logging/v1beta3"
|
||||
"google.golang.org/cloud"
|
||||
"google.golang.org/cloud/internal/transport"
|
||||
)
|
||||
|
||||
// Scope is the OAuth2 scope necessary to use Google Cloud Logging.
|
||||
const Scope = api.LoggingWriteScope
|
||||
|
||||
// Level is the log level.
|
||||
type Level int
|
||||
|
||||
const (
|
||||
// Default means no assigned severity level.
|
||||
Default Level = iota
|
||||
Debug
|
||||
Info
|
||||
Warning
|
||||
Error
|
||||
Critical
|
||||
Alert
|
||||
Emergency
|
||||
nLevel
|
||||
)
|
||||
|
||||
var levelName = [nLevel]string{
|
||||
Default: "",
|
||||
Debug: "DEBUG",
|
||||
Info: "INFO",
|
||||
Warning: "WARNING",
|
||||
Error: "ERROR",
|
||||
Critical: "CRITICAL",
|
||||
Alert: "ALERT",
|
||||
Emergency: "EMERGENCY",
|
||||
}
|
||||
|
||||
func (v Level) String() string {
|
||||
return levelName[v]
|
||||
}
|
||||
|
||||
// Client is a Google Cloud Logging client.
|
||||
// It must be constructed via NewClient.
|
||||
type Client struct {
|
||||
svc *api.Service
|
||||
logs *api.ProjectsLogsEntriesService
|
||||
projID string
|
||||
logName string
|
||||
writer [nLevel]io.Writer
|
||||
logger [nLevel]*log.Logger
|
||||
|
||||
mu sync.Mutex
|
||||
queued []*api.LogEntry
|
||||
curFlush *flushCall // currently in-flight flush
|
||||
flushTimer *time.Timer // nil before first use
|
||||
timerActive bool // whether flushTimer is armed
|
||||
inFlight int // number of log entries sent to API service but not yet ACKed
|
||||
|
||||
// For testing:
|
||||
timeNow func() time.Time // optional
|
||||
|
||||
// ServiceName may be "appengine.googleapis.com",
|
||||
// "compute.googleapis.com" or "custom.googleapis.com".
|
||||
//
|
||||
// The default is "custom.googleapis.com".
|
||||
//
|
||||
// The service name is only used by the API server to
|
||||
// determine which of the labels are used to index the logs.
|
||||
ServiceName string
|
||||
|
||||
// CommonLabels are metadata labels that apply to all log
|
||||
// entries in this request, so that you don't have to repeat
|
||||
// them in each log entry's metadata.labels field. If any of
|
||||
// the log entries contains a (key, value) with the same key
|
||||
// that is in CommonLabels, then the entry's (key, value)
|
||||
// overrides the one in CommonLabels.
|
||||
CommonLabels map[string]string
|
||||
|
||||
// BufferLimit is the maximum number of items to keep in memory
|
||||
// before flushing. Zero means automatic. A value of 1 means to
|
||||
// flush after each log entry.
|
||||
// The default is currently 10,000.
|
||||
BufferLimit int
|
||||
|
||||
// FlushAfter optionally specifies a threshold count at which buffered
|
||||
// log entries are flushed, even if the BufferInterval has not yet
|
||||
// been reached.
|
||||
// The default is currently 10.
|
||||
FlushAfter int
|
||||
|
||||
// BufferInterval is the maximum amount of time that an item
|
||||
// should remain buffered in memory before being flushed to
|
||||
// the logging service.
|
||||
// The default is currently 1 second.
|
||||
BufferInterval time.Duration
|
||||
|
||||
// Overflow is a function which runs when the Log function
|
||||
// overflows its configured buffer limit. If nil, the log
|
||||
// entry is dropped. The return value from Overflow is
|
||||
// returned by Log.
|
||||
Overflow func(*Client, Entry) error
|
||||
}
|
||||
|
||||
func (c *Client) flushAfter() int {
|
||||
if v := c.FlushAfter; v > 0 {
|
||||
return v
|
||||
}
|
||||
return 10
|
||||
}
|
||||
|
||||
func (c *Client) bufferInterval() time.Duration {
|
||||
if v := c.BufferInterval; v > 0 {
|
||||
return v
|
||||
}
|
||||
return time.Second
|
||||
}
|
||||
|
||||
func (c *Client) bufferLimit() int {
|
||||
if v := c.BufferLimit; v > 0 {
|
||||
return v
|
||||
}
|
||||
return 10000
|
||||
}
|
||||
|
||||
func (c *Client) serviceName() string {
|
||||
if v := c.ServiceName; v != "" {
|
||||
return v
|
||||
}
|
||||
return "custom.googleapis.com"
|
||||
}
|
||||
|
||||
func (c *Client) now() time.Time {
|
||||
if now := c.timeNow; now != nil {
|
||||
return now()
|
||||
}
|
||||
return time.Now()
|
||||
}
|
||||
|
||||
// Writer returns an io.Writer for the provided log level.
|
||||
//
|
||||
// Each Write call on the returned Writer generates a log entry.
|
||||
//
|
||||
// This Writer accessor does not allocate, so callers do not need to
|
||||
// cache.
|
||||
func (c *Client) Writer(v Level) io.Writer { return c.writer[v] }
|
||||
|
||||
// Logger returns a *log.Logger for the provided log level.
|
||||
//
|
||||
// A Logger for each Level is pre-allocated by NewClient with an empty
|
||||
// prefix and no flags. This Logger accessor does not allocate.
|
||||
// Callers wishing to use alternate flags (such as log.Lshortfile) may
|
||||
// mutate the returned Logger with SetFlags. Such mutations affect all
|
||||
// callers in the program.
|
||||
func (c *Client) Logger(v Level) *log.Logger { return c.logger[v] }
|
||||
|
||||
type levelWriter struct {
|
||||
level Level
|
||||
c *Client
|
||||
}
|
||||
|
||||
func (w levelWriter) Write(p []byte) (n int, err error) {
|
||||
return len(p), w.c.Log(Entry{
|
||||
Level: w.level,
|
||||
Payload: string(p),
|
||||
})
|
||||
}
|
||||
|
||||
// Entry is a log entry.
|
||||
type Entry struct {
|
||||
// Time is the time of the entry. If the zero value, the current time is used.
|
||||
Time time.Time
|
||||
|
||||
// Level is log entry's severity level.
|
||||
// The zero value means no assigned severity level.
|
||||
Level Level
|
||||
|
||||
// Payload must be either a string, []byte, or something that
|
||||
// marshals via the encoding/json package to a JSON object
|
||||
// (and not any other type of JSON value).
|
||||
Payload interface{}
|
||||
|
||||
// Labels optionally specifies key/value labels for the log entry.
|
||||
// Depending on the Client's ServiceName, these are indexed differently
|
||||
// by the Cloud Logging Service.
|
||||
// See https://cloud.google.com/logging/docs/logs_index
|
||||
// The Client.Log method takes ownership of this map.
|
||||
Labels map[string]string
|
||||
|
||||
// TODO: de-duping id
|
||||
}
|
||||
|
||||
func (c *Client) apiEntry(e Entry) (*api.LogEntry, error) {
|
||||
t := e.Time
|
||||
if t.IsZero() {
|
||||
t = c.now()
|
||||
}
|
||||
|
||||
ent := &api.LogEntry{
|
||||
Metadata: &api.LogEntryMetadata{
|
||||
Timestamp: t.UTC().Format(time.RFC3339Nano),
|
||||
ServiceName: c.serviceName(),
|
||||
Severity: e.Level.String(),
|
||||
Labels: e.Labels,
|
||||
},
|
||||
}
|
||||
switch p := e.Payload.(type) {
|
||||
case string:
|
||||
ent.TextPayload = p
|
||||
case []byte:
|
||||
ent.TextPayload = string(p)
|
||||
default:
|
||||
ent.StructPayload = api.LogEntryStructPayload(p)
|
||||
}
|
||||
return ent, nil
|
||||
}
|
||||
|
||||
// LogSync logs e synchronously without any buffering.
|
||||
// This is mostly intended for debugging or critical errors.
|
||||
func (c *Client) LogSync(e Entry) error {
|
||||
ent, err := c.apiEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = c.logs.Write(c.projID, c.logName, &api.WriteLogEntriesRequest{
|
||||
CommonLabels: c.CommonLabels,
|
||||
Entries: []*api.LogEntry{ent},
|
||||
}).Do()
|
||||
return err
|
||||
}
|
||||
|
||||
var ErrOverflow = errors.New("logging: log entry overflowed buffer limits")
|
||||
|
||||
// Log queues an entry to be sent to the logging service, subject to the
|
||||
// Client's parameters. By default, the log will be flushed within
|
||||
// one second.
|
||||
// Log only returns an error if the entry is invalid or the queue is at
|
||||
// capacity. If the queue is at capacity and the entry can't be added,
|
||||
// Log returns either ErrOverflow when c.Overflow is nil, or the
|
||||
// value returned by c.Overflow.
|
||||
func (c *Client) Log(e Entry) error {
|
||||
ent, err := c.apiEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.mu.Lock()
|
||||
buffered := len(c.queued) + c.inFlight
|
||||
|
||||
if buffered >= c.bufferLimit() {
|
||||
c.mu.Unlock()
|
||||
if fn := c.Overflow; fn != nil {
|
||||
return fn(c, e)
|
||||
}
|
||||
return ErrOverflow
|
||||
}
|
||||
defer c.mu.Unlock()
|
||||
|
||||
c.queued = append(c.queued, ent)
|
||||
if len(c.queued) >= c.flushAfter() {
|
||||
c.scheduleFlushLocked(0)
|
||||
return nil
|
||||
}
|
||||
c.scheduleFlushLocked(c.bufferInterval())
|
||||
return nil
|
||||
}
|
||||
|
||||
// c.mu must be held.
|
||||
//
|
||||
// d will be one of two values: either c.BufferInterval (or its
|
||||
// default value) or 0.
|
||||
func (c *Client) scheduleFlushLocked(d time.Duration) {
|
||||
if c.inFlight > 0 {
|
||||
// For now to keep things simple, only allow one HTTP
|
||||
// request in flight at a time.
|
||||
return
|
||||
}
|
||||
switch {
|
||||
case c.flushTimer == nil:
|
||||
// First flush.
|
||||
c.timerActive = true
|
||||
c.flushTimer = time.AfterFunc(d, c.timeoutFlush)
|
||||
case c.timerActive && d == 0:
|
||||
// Make it happen sooner. For example, this is the
|
||||
// case of transitioning from a 1 second flush after
|
||||
// the 1st item to an immediate flush after the 10th
|
||||
// item.
|
||||
c.flushTimer.Reset(0)
|
||||
case !c.timerActive:
|
||||
c.timerActive = true
|
||||
c.flushTimer.Reset(d)
|
||||
default:
|
||||
// else timer was already active, also at d > 0,
|
||||
// so we don't touch it and let it fire as previously
|
||||
// scheduled.
|
||||
}
|
||||
}
|
||||
|
||||
// timeoutFlush runs in its own goroutine (from time.AfterFunc) and
|
||||
// flushes c.queued.
|
||||
func (c *Client) timeoutFlush() {
|
||||
c.mu.Lock()
|
||||
c.timerActive = false
|
||||
c.mu.Unlock()
|
||||
if err := c.Flush(); err != nil {
|
||||
// schedule another try
|
||||
// TODO: smarter back-off?
|
||||
c.mu.Lock()
|
||||
c.scheduleFlushLocked(5 * time.Second)
|
||||
c.mu.Unlock()
|
||||
}
|
||||
}
|
||||
|
||||
// Ping reports whether the client's connection to Google Cloud
|
||||
// Logging and the authentication configuration are valid.
|
||||
func (c *Client) Ping() error {
|
||||
_, err := c.logs.Write(c.projID, c.logName, &api.WriteLogEntriesRequest{
|
||||
Entries: []*api.LogEntry{},
|
||||
}).Do()
|
||||
return err
|
||||
}
|
||||
|
||||
// Flush flushes any buffered log entries.
|
||||
func (c *Client) Flush() error {
|
||||
var numFlush int
|
||||
c.mu.Lock()
|
||||
for {
|
||||
// We're already flushing (or we just started flushing
|
||||
// ourselves), so wait for it to finish.
|
||||
if f := c.curFlush; f != nil {
|
||||
wasEmpty := len(c.queued) == 0
|
||||
c.mu.Unlock()
|
||||
<-f.donec // wait for it
|
||||
numFlush++
|
||||
// Terminate whenever there's an error, we've
|
||||
// already flushed twice (one that was already
|
||||
// in-flight when flush was called, and then
|
||||
// one we instigated), or the queue was empty
|
||||
// when we released the locked (meaning this
|
||||
// in-flight flush removes everything present
|
||||
// when Flush was called, and we don't need to
|
||||
// kick off a new flush for things arriving
|
||||
// afterward)
|
||||
if f.err != nil || numFlush == 2 || wasEmpty {
|
||||
return f.err
|
||||
}
|
||||
// Otherwise, re-obtain the lock and loop,
|
||||
// starting over with seeing if a flush is in
|
||||
// progress, which might've been started by a
|
||||
// different goroutine before aquiring this
|
||||
// lock again.
|
||||
c.mu.Lock()
|
||||
continue
|
||||
}
|
||||
|
||||
// Terminal case:
|
||||
if len(c.queued) == 0 {
|
||||
c.mu.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
c.startFlushLocked()
|
||||
}
|
||||
}
|
||||
|
||||
// requires c.mu be held.
|
||||
func (c *Client) startFlushLocked() {
|
||||
if c.curFlush != nil {
|
||||
panic("internal error: flush already in flight")
|
||||
}
|
||||
if len(c.queued) == 0 {
|
||||
panic("internal error: no items queued")
|
||||
}
|
||||
logEntries := c.queued
|
||||
c.inFlight = len(logEntries)
|
||||
c.queued = nil
|
||||
|
||||
flush := &flushCall{
|
||||
donec: make(chan struct{}),
|
||||
}
|
||||
c.curFlush = flush
|
||||
go func() {
|
||||
defer close(flush.donec)
|
||||
_, err := c.logs.Write(c.projID, c.logName, &api.WriteLogEntriesRequest{
|
||||
CommonLabels: c.CommonLabels,
|
||||
Entries: logEntries,
|
||||
}).Do()
|
||||
flush.err = err
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
c.inFlight = 0
|
||||
c.curFlush = nil
|
||||
if err != nil {
|
||||
c.queued = append(c.queued, logEntries...)
|
||||
} else if len(c.queued) > 0 {
|
||||
c.scheduleFlushLocked(c.bufferInterval())
|
||||
}
|
||||
}()
|
||||
|
||||
}
|
||||
|
||||
const prodAddr = "https://logging.googleapis.com/"
|
||||
|
||||
const userAgent = "gcloud-golang-logging/20150922"
|
||||
|
||||
// NewClient returns a new log client, logging to the named log in the
|
||||
// provided project.
|
||||
//
|
||||
// The exported fields on the returned client may be modified before
|
||||
// the client is used for logging. Once log entries are in flight,
|
||||
// the fields must not be modified.
|
||||
func NewClient(ctx context.Context, projectID, logName string, opts ...cloud.ClientOption) (*Client, error) {
|
||||
httpClient, endpoint, err := transport.NewHTTPClient(ctx, append([]cloud.ClientOption{
|
||||
cloud.WithEndpoint(prodAddr),
|
||||
cloud.WithScopes(api.CloudPlatformScope),
|
||||
cloud.WithUserAgent(userAgent),
|
||||
}, opts...)...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
svc, err := api.New(httpClient)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
svc.BasePath = endpoint
|
||||
c := &Client{
|
||||
svc: svc,
|
||||
logs: api.NewProjectsLogsEntriesService(svc),
|
||||
logName: logName,
|
||||
projID: projectID,
|
||||
}
|
||||
for i := range c.writer {
|
||||
level := Level(i)
|
||||
c.writer[level] = levelWriter{level, c}
|
||||
c.logger[level] = log.New(c.writer[level], "", 0)
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// flushCall is an in-flight or completed flush.
|
||||
type flushCall struct {
|
||||
donec chan struct{} // closed when response is in
|
||||
err error // error is valid after wg is Done
|
||||
}
|
102
vendor/google.golang.org/cloud/option.go
generated
vendored
102
vendor/google.golang.org/cloud/option.go
generated
vendored
|
@ -1,102 +0,0 @@
|
|||
// Copyright 2015 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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 cloud
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
"google.golang.org/cloud/internal/opts"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// ClientOption is used when construct clients for each cloud service.
|
||||
type ClientOption interface {
|
||||
// Resolve configures the given DialOpts for this option.
|
||||
Resolve(*opts.DialOpt)
|
||||
}
|
||||
|
||||
// WithTokenSource returns a ClientOption that specifies an OAuth2 token
|
||||
// source to be used as the basis for authentication.
|
||||
func WithTokenSource(s oauth2.TokenSource) ClientOption {
|
||||
return withTokenSource{s}
|
||||
}
|
||||
|
||||
type withTokenSource struct{ ts oauth2.TokenSource }
|
||||
|
||||
func (w withTokenSource) Resolve(o *opts.DialOpt) {
|
||||
o.TokenSource = w.ts
|
||||
}
|
||||
|
||||
// WithEndpoint returns a ClientOption that overrides the default endpoint
|
||||
// to be used for a service.
|
||||
func WithEndpoint(url string) ClientOption {
|
||||
return withEndpoint(url)
|
||||
}
|
||||
|
||||
type withEndpoint string
|
||||
|
||||
func (w withEndpoint) Resolve(o *opts.DialOpt) {
|
||||
o.Endpoint = string(w)
|
||||
}
|
||||
|
||||
// WithScopes returns a ClientOption that overrides the default OAuth2 scopes
|
||||
// to be used for a service.
|
||||
func WithScopes(scope ...string) ClientOption {
|
||||
return withScopes(scope)
|
||||
}
|
||||
|
||||
type withScopes []string
|
||||
|
||||
func (w withScopes) Resolve(o *opts.DialOpt) {
|
||||
s := make([]string, len(w))
|
||||
copy(s, w)
|
||||
o.Scopes = s
|
||||
}
|
||||
|
||||
// WithUserAgent returns a ClientOption that sets the User-Agent.
|
||||
func WithUserAgent(ua string) ClientOption {
|
||||
return withUA(ua)
|
||||
}
|
||||
|
||||
type withUA string
|
||||
|
||||
func (w withUA) Resolve(o *opts.DialOpt) { o.UserAgent = string(w) }
|
||||
|
||||
// WithBaseHTTP returns a ClientOption that specifies the HTTP client to
|
||||
// use as the basis of communications. This option may only be used with
|
||||
// services that support HTTP as their communication transport.
|
||||
func WithBaseHTTP(client *http.Client) ClientOption {
|
||||
return withBaseHTTP{client}
|
||||
}
|
||||
|
||||
type withBaseHTTP struct{ client *http.Client }
|
||||
|
||||
func (w withBaseHTTP) Resolve(o *opts.DialOpt) {
|
||||
o.HTTPClient = w.client
|
||||
}
|
||||
|
||||
// WithBaseGRPC returns a ClientOption that specifies the GRPC client
|
||||
// connection to use as the basis of communications. This option many only be
|
||||
// used with services that support HRPC as their communication transport.
|
||||
func WithBaseGRPC(client *grpc.ClientConn) ClientOption {
|
||||
return withBaseGRPC{client}
|
||||
}
|
||||
|
||||
type withBaseGRPC struct{ client *grpc.ClientConn }
|
||||
|
||||
func (w withBaseGRPC) Resolve(o *opts.DialOpt) {
|
||||
o.GRPCClient = w.client
|
||||
}
|
202
vendor/google.golang.org/genproto/LICENSE
generated
vendored
Normal file
202
vendor/google.golang.org/genproto/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,202 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
100
vendor/google.golang.org/genproto/googleapis/api/label/label.pb.go
generated
vendored
Normal file
100
vendor/google.golang.org/genproto/googleapis/api/label/label.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/label/label.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package google_api is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
google.golang.org/genproto/googleapis/api/label/label.proto
|
||||
|
||||
It has these top-level messages:
|
||||
LabelDescriptor
|
||||
*/
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/label"
|
||||
|
||||
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
|
||||
|
||||
// Value types that can be used as label values.
|
||||
type LabelDescriptor_ValueType int32
|
||||
|
||||
const (
|
||||
// A variable-length string. This is the default.
|
||||
LabelDescriptor_STRING LabelDescriptor_ValueType = 0
|
||||
// Boolean; true or false.
|
||||
LabelDescriptor_BOOL LabelDescriptor_ValueType = 1
|
||||
// A 64-bit signed integer.
|
||||
LabelDescriptor_INT64 LabelDescriptor_ValueType = 2
|
||||
)
|
||||
|
||||
var LabelDescriptor_ValueType_name = map[int32]string{
|
||||
0: "STRING",
|
||||
1: "BOOL",
|
||||
2: "INT64",
|
||||
}
|
||||
var LabelDescriptor_ValueType_value = map[string]int32{
|
||||
"STRING": 0,
|
||||
"BOOL": 1,
|
||||
"INT64": 2,
|
||||
}
|
||||
|
||||
func (x LabelDescriptor_ValueType) String() string {
|
||||
return proto.EnumName(LabelDescriptor_ValueType_name, int32(x))
|
||||
}
|
||||
func (LabelDescriptor_ValueType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} }
|
||||
|
||||
// A description of a label.
|
||||
type LabelDescriptor struct {
|
||||
// The label key.
|
||||
Key string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
|
||||
// The type of data that can be assigned to the label.
|
||||
ValueType LabelDescriptor_ValueType `protobuf:"varint,2,opt,name=value_type,json=valueType,enum=google.api.LabelDescriptor_ValueType" json:"value_type,omitempty"`
|
||||
// A human-readable description for the label.
|
||||
Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
|
||||
}
|
||||
|
||||
func (m *LabelDescriptor) Reset() { *m = LabelDescriptor{} }
|
||||
func (m *LabelDescriptor) String() string { return proto.CompactTextString(m) }
|
||||
func (*LabelDescriptor) ProtoMessage() {}
|
||||
func (*LabelDescriptor) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*LabelDescriptor)(nil), "google.api.LabelDescriptor")
|
||||
proto.RegisterEnum("google.api.LabelDescriptor_ValueType", LabelDescriptor_ValueType_name, LabelDescriptor_ValueType_value)
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/label/label.proto", fileDescriptor0)
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 240 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xb2, 0x4e, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0x4b, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0xcb, 0x2f, 0x4a, 0xd7, 0x4f, 0x4f,
|
||||
0xcd, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x87, 0x48, 0x25, 0x16, 0x64, 0x16, 0xeb, 0x03, 0x09,
|
||||
0xfd, 0x9c, 0xc4, 0xa4, 0xd4, 0x1c, 0x08, 0xa9, 0x07, 0x56, 0x20, 0xc4, 0x05, 0xd5, 0x0c, 0x94,
|
||||
0x55, 0xda, 0xc9, 0xc8, 0xc5, 0xef, 0x03, 0x92, 0x73, 0x49, 0x2d, 0x4e, 0x2e, 0xca, 0x2c, 0x28,
|
||||
0xc9, 0x2f, 0x12, 0x12, 0xe0, 0x62, 0xce, 0x4e, 0xad, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c,
|
||||
0x02, 0x31, 0x85, 0x5c, 0xb8, 0xb8, 0xca, 0x12, 0x73, 0x4a, 0x53, 0xe3, 0x4b, 0x2a, 0x0b, 0x52,
|
||||
0x25, 0x98, 0x80, 0x12, 0x7c, 0x46, 0xaa, 0x7a, 0x08, 0x63, 0xf4, 0xd0, 0x8c, 0xd0, 0x0b, 0x03,
|
||||
0xa9, 0x0e, 0x01, 0x2a, 0x0e, 0xe2, 0x2c, 0x83, 0x31, 0x85, 0x14, 0xb8, 0xb8, 0x53, 0xa0, 0x4a,
|
||||
0x32, 0xf3, 0xf3, 0x24, 0x98, 0xc1, 0xe6, 0x23, 0x0b, 0x29, 0xe9, 0x70, 0x71, 0xc2, 0x75, 0x0a,
|
||||
0x71, 0x71, 0xb1, 0x05, 0x87, 0x04, 0x79, 0xfa, 0xb9, 0x0b, 0x30, 0x08, 0x71, 0x70, 0xb1, 0x38,
|
||||
0xf9, 0xfb, 0xfb, 0x08, 0x30, 0x0a, 0x71, 0x72, 0xb1, 0x7a, 0xfa, 0x85, 0x98, 0x99, 0x08, 0x30,
|
||||
0x39, 0x69, 0x70, 0xf1, 0x25, 0xe7, 0xe7, 0x22, 0x39, 0xc3, 0x89, 0x0b, 0xec, 0x8e, 0x00, 0x90,
|
||||
0x2f, 0x03, 0x18, 0x7f, 0x30, 0x32, 0x2e, 0x62, 0x62, 0x71, 0x77, 0x0c, 0xf0, 0x4c, 0x62, 0x03,
|
||||
0x7b, 0xdc, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xca, 0x32, 0x56, 0x5f, 0x37, 0x01, 0x00, 0x00,
|
||||
}
|
48
vendor/google.golang.org/genproto/googleapis/api/label/label.proto
generated
vendored
Normal file
48
vendor/google.golang.org/genproto/googleapis/api/label/label.proto
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "LabelProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
|
||||
// A description of a label.
|
||||
message LabelDescriptor {
|
||||
// Value types that can be used as label values.
|
||||
enum ValueType {
|
||||
// A variable-length string. This is the default.
|
||||
STRING = 0;
|
||||
|
||||
// Boolean; true or false.
|
||||
BOOL = 1;
|
||||
|
||||
// A 64-bit signed integer.
|
||||
INT64 = 2;
|
||||
}
|
||||
|
||||
// The label key.
|
||||
string key = 1;
|
||||
|
||||
// The type of data that can be assigned to the label.
|
||||
ValueType value_type = 2;
|
||||
|
||||
// A human-readable description for the label.
|
||||
string description = 3;
|
||||
}
|
303
vendor/google.golang.org/genproto/googleapis/api/metric/metric.pb.go
generated
vendored
Normal file
303
vendor/google.golang.org/genproto/googleapis/api/metric/metric.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,303 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/metric/metric.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package google_api is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
google.golang.org/genproto/googleapis/api/metric/metric.proto
|
||||
|
||||
It has these top-level messages:
|
||||
MetricDescriptor
|
||||
Metric
|
||||
*/
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/metric"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import google_api1 "google.golang.org/genproto/googleapis/api/label"
|
||||
|
||||
// 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
|
||||
|
||||
// The kind of measurement. It describes how the data is reported.
|
||||
type MetricDescriptor_MetricKind int32
|
||||
|
||||
const (
|
||||
// Do not use this default value.
|
||||
MetricDescriptor_METRIC_KIND_UNSPECIFIED MetricDescriptor_MetricKind = 0
|
||||
// An instantaneous measurement of a value.
|
||||
MetricDescriptor_GAUGE MetricDescriptor_MetricKind = 1
|
||||
// The change in a value during a time interval.
|
||||
MetricDescriptor_DELTA MetricDescriptor_MetricKind = 2
|
||||
// A value accumulated over a time interval. Cumulative
|
||||
// measurements in a time series should have the same start time
|
||||
// and increasing end times, until an event resets the cumulative
|
||||
// value to zero and sets a new start time for the following
|
||||
// points.
|
||||
MetricDescriptor_CUMULATIVE MetricDescriptor_MetricKind = 3
|
||||
)
|
||||
|
||||
var MetricDescriptor_MetricKind_name = map[int32]string{
|
||||
0: "METRIC_KIND_UNSPECIFIED",
|
||||
1: "GAUGE",
|
||||
2: "DELTA",
|
||||
3: "CUMULATIVE",
|
||||
}
|
||||
var MetricDescriptor_MetricKind_value = map[string]int32{
|
||||
"METRIC_KIND_UNSPECIFIED": 0,
|
||||
"GAUGE": 1,
|
||||
"DELTA": 2,
|
||||
"CUMULATIVE": 3,
|
||||
}
|
||||
|
||||
func (x MetricDescriptor_MetricKind) String() string {
|
||||
return proto.EnumName(MetricDescriptor_MetricKind_name, int32(x))
|
||||
}
|
||||
func (MetricDescriptor_MetricKind) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor0, []int{0, 0}
|
||||
}
|
||||
|
||||
// The value type of a metric.
|
||||
type MetricDescriptor_ValueType int32
|
||||
|
||||
const (
|
||||
// Do not use this default value.
|
||||
MetricDescriptor_VALUE_TYPE_UNSPECIFIED MetricDescriptor_ValueType = 0
|
||||
// The value is a boolean.
|
||||
// This value type can be used only if the metric kind is `GAUGE`.
|
||||
MetricDescriptor_BOOL MetricDescriptor_ValueType = 1
|
||||
// The value is a signed 64-bit integer.
|
||||
MetricDescriptor_INT64 MetricDescriptor_ValueType = 2
|
||||
// The value is a double precision floating point number.
|
||||
MetricDescriptor_DOUBLE MetricDescriptor_ValueType = 3
|
||||
// The value is a text string.
|
||||
// This value type can be used only if the metric kind is `GAUGE`.
|
||||
MetricDescriptor_STRING MetricDescriptor_ValueType = 4
|
||||
// The value is a [`Distribution`][google.api.Distribution].
|
||||
MetricDescriptor_DISTRIBUTION MetricDescriptor_ValueType = 5
|
||||
// The value is money.
|
||||
MetricDescriptor_MONEY MetricDescriptor_ValueType = 6
|
||||
)
|
||||
|
||||
var MetricDescriptor_ValueType_name = map[int32]string{
|
||||
0: "VALUE_TYPE_UNSPECIFIED",
|
||||
1: "BOOL",
|
||||
2: "INT64",
|
||||
3: "DOUBLE",
|
||||
4: "STRING",
|
||||
5: "DISTRIBUTION",
|
||||
6: "MONEY",
|
||||
}
|
||||
var MetricDescriptor_ValueType_value = map[string]int32{
|
||||
"VALUE_TYPE_UNSPECIFIED": 0,
|
||||
"BOOL": 1,
|
||||
"INT64": 2,
|
||||
"DOUBLE": 3,
|
||||
"STRING": 4,
|
||||
"DISTRIBUTION": 5,
|
||||
"MONEY": 6,
|
||||
}
|
||||
|
||||
func (x MetricDescriptor_ValueType) String() string {
|
||||
return proto.EnumName(MetricDescriptor_ValueType_name, int32(x))
|
||||
}
|
||||
func (MetricDescriptor_ValueType) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor0, []int{0, 1}
|
||||
}
|
||||
|
||||
// Defines a metric type and its schema.
|
||||
type MetricDescriptor struct {
|
||||
// Resource name. The format of the name may vary between different
|
||||
// implementations. For examples:
|
||||
//
|
||||
// projects/{project_id}/metricDescriptors/{type=**}
|
||||
// metricDescriptors/{type=**}
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// The metric type including a DNS name prefix, for example
|
||||
// `"compute.googleapis.com/instance/cpu/utilization"`. Metric types
|
||||
// should use a natural hierarchical grouping such as the following:
|
||||
//
|
||||
// compute.googleapis.com/instance/cpu/utilization
|
||||
// compute.googleapis.com/instance/disk/read_ops_count
|
||||
// compute.googleapis.com/instance/network/received_bytes_count
|
||||
//
|
||||
// Note that if the metric type changes, the monitoring data will be
|
||||
// discontinued, and anything depends on it will break, such as monitoring
|
||||
// dashboards, alerting rules and quota limits. Therefore, once a metric has
|
||||
// been published, its type should be immutable.
|
||||
Type string `protobuf:"bytes,8,opt,name=type" json:"type,omitempty"`
|
||||
// The set of labels that can be used to describe a specific instance of this
|
||||
// metric type. For example, the
|
||||
// `compute.googleapis.com/instance/network/received_bytes_count` metric type
|
||||
// has a label, `loadbalanced`, that specifies whether the traffic was
|
||||
// received through a load balanced IP address.
|
||||
Labels []*google_api1.LabelDescriptor `protobuf:"bytes,2,rep,name=labels" json:"labels,omitempty"`
|
||||
// Whether the metric records instantaneous values, changes to a value, etc.
|
||||
MetricKind MetricDescriptor_MetricKind `protobuf:"varint,3,opt,name=metric_kind,json=metricKind,enum=google.api.MetricDescriptor_MetricKind" json:"metric_kind,omitempty"`
|
||||
// Whether the measurement is an integer, a floating-point number, etc.
|
||||
ValueType MetricDescriptor_ValueType `protobuf:"varint,4,opt,name=value_type,json=valueType,enum=google.api.MetricDescriptor_ValueType" json:"value_type,omitempty"`
|
||||
// The unit in which the metric value is reported. It is only applicable
|
||||
// if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The
|
||||
// supported units are a subset of [The Unified Code for Units of
|
||||
// Measure](http://unitsofmeasure.org/ucum.html) standard:
|
||||
//
|
||||
// **Basic units (UNIT)**
|
||||
//
|
||||
// * `bit` bit
|
||||
// * `By` byte
|
||||
// * `s` second
|
||||
// * `min` minute
|
||||
// * `h` hour
|
||||
// * `d` day
|
||||
//
|
||||
// **Prefixes (PREFIX)**
|
||||
//
|
||||
// * `k` kilo (10**3)
|
||||
// * `M` mega (10**6)
|
||||
// * `G` giga (10**9)
|
||||
// * `T` tera (10**12)
|
||||
// * `P` peta (10**15)
|
||||
// * `E` exa (10**18)
|
||||
// * `Z` zetta (10**21)
|
||||
// * `Y` yotta (10**24)
|
||||
// * `m` milli (10**-3)
|
||||
// * `u` micro (10**-6)
|
||||
// * `n` nano (10**-9)
|
||||
// * `p` pico (10**-12)
|
||||
// * `f` femto (10**-15)
|
||||
// * `a` atto (10**-18)
|
||||
// * `z` zepto (10**-21)
|
||||
// * `y` yocto (10**-24)
|
||||
// * `Ki` kibi (2**10)
|
||||
// * `Mi` mebi (2**20)
|
||||
// * `Gi` gibi (2**30)
|
||||
// * `Ti` tebi (2**40)
|
||||
//
|
||||
// **Grammar**
|
||||
//
|
||||
// The grammar includes the dimensionless unit `1`, such as `1/s`.
|
||||
//
|
||||
// The grammar also includes these connectors:
|
||||
//
|
||||
// * `/` division (as an infix operator, e.g. `1/s`).
|
||||
// * `.` multiplication (as an infix operator, e.g. `GBy.d`)
|
||||
//
|
||||
// The grammar for a unit is as follows:
|
||||
//
|
||||
// Expression = Component { "." Component } { "/" Component } ;
|
||||
//
|
||||
// Component = [ PREFIX ] UNIT [ Annotation ]
|
||||
// | Annotation
|
||||
// | "1"
|
||||
// ;
|
||||
//
|
||||
// Annotation = "{" NAME "}" ;
|
||||
//
|
||||
// Notes:
|
||||
//
|
||||
// * `Annotation` is just a comment if it follows a `UNIT` and is
|
||||
// equivalent to `1` if it is used alone. For examples,
|
||||
// `{requests}/s == 1/s`, `By{transmitted}/s == By/s`.
|
||||
// * `NAME` is a sequence of non-blank printable ASCII characters not
|
||||
// containing '{' or '}'.
|
||||
Unit string `protobuf:"bytes,5,opt,name=unit" json:"unit,omitempty"`
|
||||
// A detailed description of the metric, which can be used in documentation.
|
||||
Description string `protobuf:"bytes,6,opt,name=description" json:"description,omitempty"`
|
||||
// A concise name for the metric, which can be displayed in user interfaces.
|
||||
// Use sentence case without an ending period, for example "Request count".
|
||||
DisplayName string `protobuf:"bytes,7,opt,name=display_name,json=displayName" json:"display_name,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MetricDescriptor) Reset() { *m = MetricDescriptor{} }
|
||||
func (m *MetricDescriptor) String() string { return proto.CompactTextString(m) }
|
||||
func (*MetricDescriptor) ProtoMessage() {}
|
||||
func (*MetricDescriptor) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *MetricDescriptor) GetLabels() []*google_api1.LabelDescriptor {
|
||||
if m != nil {
|
||||
return m.Labels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A specific metric identified by specifying values for all of the
|
||||
// labels of a [`MetricDescriptor`][google.api.MetricDescriptor].
|
||||
type Metric struct {
|
||||
// An existing metric type, see [google.api.MetricDescriptor][google.api.MetricDescriptor].
|
||||
// For example, `compute.googleapis.com/instance/cpu/usage_time`.
|
||||
Type string `protobuf:"bytes,3,opt,name=type" json:"type,omitempty"`
|
||||
// The set of labels that uniquely identify a metric. To specify a
|
||||
// metric, all labels enumerated in the `MetricDescriptor` must be
|
||||
// assigned values.
|
||||
Labels map[string]string `protobuf:"bytes,2,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
}
|
||||
|
||||
func (m *Metric) Reset() { *m = Metric{} }
|
||||
func (m *Metric) String() string { return proto.CompactTextString(m) }
|
||||
func (*Metric) ProtoMessage() {}
|
||||
func (*Metric) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
func (m *Metric) GetLabels() map[string]string {
|
||||
if m != nil {
|
||||
return m.Labels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MetricDescriptor)(nil), "google.api.MetricDescriptor")
|
||||
proto.RegisterType((*Metric)(nil), "google.api.Metric")
|
||||
proto.RegisterEnum("google.api.MetricDescriptor_MetricKind", MetricDescriptor_MetricKind_name, MetricDescriptor_MetricKind_value)
|
||||
proto.RegisterEnum("google.api.MetricDescriptor_ValueType", MetricDescriptor_ValueType_name, MetricDescriptor_ValueType_value)
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/metric/metric.proto", fileDescriptor0)
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 498 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x52, 0xdf, 0x6b, 0x9b, 0x50,
|
||||
0x14, 0x9e, 0x89, 0x71, 0xcd, 0x49, 0x09, 0x72, 0x19, 0x9b, 0xa4, 0x30, 0xb2, 0x3c, 0x74, 0x7d,
|
||||
0x4a, 0xa0, 0x1d, 0x65, 0x3f, 0xd8, 0x83, 0xc6, 0xbb, 0x4c, 0x6a, 0x54, 0xac, 0x06, 0xfa, 0x24,
|
||||
0x36, 0x11, 0x91, 0x1a, 0x75, 0x6a, 0x0b, 0xf9, 0x2b, 0xf6, 0x17, 0xec, 0x65, 0x7f, 0xe9, 0xee,
|
||||
0x0f, 0x9b, 0x48, 0x06, 0x63, 0x2f, 0xe6, 0xbb, 0xdf, 0x39, 0xe7, 0xbb, 0xdf, 0xb9, 0xf9, 0xe0,
|
||||
0x6b, 0x9c, 0xe7, 0x71, 0x1a, 0x4d, 0xe3, 0x3c, 0x0d, 0xb3, 0x78, 0x9a, 0x97, 0xf1, 0x2c, 0x8e,
|
||||
0xb2, 0xa2, 0xcc, 0xeb, 0x7c, 0xc6, 0x4b, 0x61, 0x91, 0x54, 0x33, 0xf2, 0x99, 0x6d, 0xa3, 0xba,
|
||||
0x4c, 0xd6, 0xcd, 0xcf, 0x94, 0xb5, 0x20, 0x68, 0xc6, 0x49, 0x7d, 0xf4, 0xe5, 0xff, 0xa5, 0xd2,
|
||||
0xf0, 0x3e, 0x4a, 0xf9, 0x97, 0x0b, 0x4d, 0x7e, 0x89, 0x20, 0x2f, 0x99, 0xb2, 0x1e, 0x55, 0xeb,
|
||||
0x32, 0x29, 0xea, 0xbc, 0x44, 0x08, 0xc4, 0x2c, 0xdc, 0x46, 0x8a, 0x30, 0x16, 0x2e, 0xfa, 0x2e,
|
||||
0xc3, 0x94, 0xab, 0x77, 0x45, 0xa4, 0x9c, 0x70, 0x8e, 0x62, 0x74, 0x05, 0x12, 0xd3, 0xaa, 0x94,
|
||||
0xce, 0xb8, 0x7b, 0x31, 0xb8, 0x3c, 0x9b, 0x1e, 0x6c, 0x4d, 0x4d, 0x5a, 0x39, 0x88, 0xba, 0x4d,
|
||||
0x2b, 0xfa, 0x0e, 0x03, 0xbe, 0x4a, 0xf0, 0x90, 0x64, 0x1b, 0xa5, 0x4b, 0xf4, 0x86, 0x97, 0xef,
|
||||
0xdb, 0x93, 0xc7, 0x7e, 0x1a, 0xe2, 0x86, 0xb4, 0xbb, 0xb0, 0xdd, 0x63, 0x84, 0x01, 0x9e, 0xc2,
|
||||
0xf4, 0x31, 0x0a, 0x98, 0x31, 0x91, 0x09, 0x9d, 0xff, 0x53, 0x68, 0x45, 0xdb, 0x3d, 0xd2, 0xed,
|
||||
0xf6, 0x9f, 0x9e, 0x21, 0xdd, 0xec, 0x31, 0x4b, 0x6a, 0xa5, 0xc7, 0x37, 0xa3, 0x18, 0x8d, 0x61,
|
||||
0xb0, 0x69, 0xc6, 0x92, 0x3c, 0x53, 0x24, 0x56, 0x6a, 0x53, 0xe8, 0x1d, 0x9c, 0x6e, 0x92, 0xaa,
|
||||
0x48, 0xc3, 0x5d, 0xc0, 0xde, 0xea, 0x65, 0xd3, 0xc2, 0x39, 0x8b, 0x50, 0x13, 0x1b, 0xe0, 0xe0,
|
||||
0x1c, 0x9d, 0xc1, 0x9b, 0x25, 0xf6, 0x5c, 0x63, 0x1e, 0xdc, 0x18, 0x96, 0x1e, 0xf8, 0xd6, 0xad,
|
||||
0x83, 0xe7, 0xc6, 0x37, 0x03, 0xeb, 0xf2, 0x0b, 0xd4, 0x87, 0xde, 0x42, 0xf5, 0x17, 0x58, 0x16,
|
||||
0x28, 0xd4, 0xb1, 0xe9, 0xa9, 0x72, 0x07, 0x0d, 0x01, 0xe6, 0xfe, 0xd2, 0x37, 0x55, 0xcf, 0x58,
|
||||
0x61, 0xb9, 0x3b, 0xf9, 0x01, 0xfd, 0xfd, 0x06, 0x68, 0x04, 0xaf, 0x57, 0xaa, 0xe9, 0xe3, 0xc0,
|
||||
0xbb, 0x73, 0xf0, 0x91, 0xdc, 0x09, 0x88, 0x9a, 0x6d, 0x9b, 0x5c, 0xcd, 0xb0, 0xbc, 0xeb, 0x0f,
|
||||
0x44, 0x0d, 0x40, 0xd2, 0x6d, 0x5f, 0x33, 0x89, 0x12, 0xc5, 0xb7, 0xc4, 0x8b, 0xb5, 0x90, 0x45,
|
||||
0x24, 0xc3, 0xa9, 0x6e, 0xd0, 0x93, 0xe6, 0x7b, 0x86, 0x6d, 0xc9, 0x3d, 0x3a, 0xb4, 0xb4, 0x2d,
|
||||
0x7c, 0x27, 0x4b, 0x93, 0x9f, 0x02, 0x48, 0x7c, 0x89, 0x7d, 0x02, 0xba, 0xad, 0x04, 0x5c, 0x1f,
|
||||
0x25, 0xe0, 0xed, 0xdf, 0xcf, 0xcf, 0x83, 0x50, 0xe1, 0xac, 0x2e, 0x77, 0xcf, 0x21, 0x18, 0x7d,
|
||||
0x82, 0x41, 0x8b, 0x26, 0x16, 0xba, 0x0f, 0xd1, 0xae, 0xc9, 0x1b, 0x85, 0xe8, 0x15, 0xf4, 0xd8,
|
||||
0x3f, 0x44, 0x74, 0x29, 0xc7, 0x0f, 0x9f, 0x3b, 0x1f, 0x05, 0xed, 0x1c, 0x86, 0xeb, 0x7c, 0xdb,
|
||||
0xba, 0x47, 0x1b, 0xf0, 0x8b, 0x1c, 0x1a, 0x68, 0x47, 0xf8, 0xdd, 0x11, 0x17, 0xaa, 0x63, 0xdc,
|
||||
0x4b, 0x2c, 0xe0, 0x57, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x9e, 0x86, 0xb0, 0x69, 0x6a, 0x03,
|
||||
0x00, 0x00,
|
||||
}
|
193
vendor/google.golang.org/genproto/googleapis/api/metric/metric.proto
generated
vendored
Normal file
193
vendor/google.golang.org/genproto/googleapis/api/metric/metric.proto
generated
vendored
Normal file
|
@ -0,0 +1,193 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
import "google.golang.org/genproto/googleapis/api/label/label.proto"; // from google/api/label.proto
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "MetricProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
|
||||
// Defines a metric type and its schema.
|
||||
message MetricDescriptor {
|
||||
// The kind of measurement. It describes how the data is reported.
|
||||
enum MetricKind {
|
||||
// Do not use this default value.
|
||||
METRIC_KIND_UNSPECIFIED = 0;
|
||||
|
||||
// An instantaneous measurement of a value.
|
||||
GAUGE = 1;
|
||||
|
||||
// The change in a value during a time interval.
|
||||
DELTA = 2;
|
||||
|
||||
// A value accumulated over a time interval. Cumulative
|
||||
// measurements in a time series should have the same start time
|
||||
// and increasing end times, until an event resets the cumulative
|
||||
// value to zero and sets a new start time for the following
|
||||
// points.
|
||||
CUMULATIVE = 3;
|
||||
}
|
||||
|
||||
// The value type of a metric.
|
||||
enum ValueType {
|
||||
// Do not use this default value.
|
||||
VALUE_TYPE_UNSPECIFIED = 0;
|
||||
|
||||
// The value is a boolean.
|
||||
// This value type can be used only if the metric kind is `GAUGE`.
|
||||
BOOL = 1;
|
||||
|
||||
// The value is a signed 64-bit integer.
|
||||
INT64 = 2;
|
||||
|
||||
// The value is a double precision floating point number.
|
||||
DOUBLE = 3;
|
||||
|
||||
// The value is a text string.
|
||||
// This value type can be used only if the metric kind is `GAUGE`.
|
||||
STRING = 4;
|
||||
|
||||
// The value is a [`Distribution`][google.api.Distribution].
|
||||
DISTRIBUTION = 5;
|
||||
|
||||
// The value is money.
|
||||
MONEY = 6;
|
||||
}
|
||||
|
||||
// Resource name. The format of the name may vary between different
|
||||
// implementations. For examples:
|
||||
//
|
||||
// projects/{project_id}/metricDescriptors/{type=**}
|
||||
// metricDescriptors/{type=**}
|
||||
string name = 1;
|
||||
|
||||
// The metric type including a DNS name prefix, for example
|
||||
// `"compute.googleapis.com/instance/cpu/utilization"`. Metric types
|
||||
// should use a natural hierarchical grouping such as the following:
|
||||
//
|
||||
// compute.googleapis.com/instance/cpu/utilization
|
||||
// compute.googleapis.com/instance/disk/read_ops_count
|
||||
// compute.googleapis.com/instance/network/received_bytes_count
|
||||
//
|
||||
// Note that if the metric type changes, the monitoring data will be
|
||||
// discontinued, and anything depends on it will break, such as monitoring
|
||||
// dashboards, alerting rules and quota limits. Therefore, once a metric has
|
||||
// been published, its type should be immutable.
|
||||
string type = 8;
|
||||
|
||||
// The set of labels that can be used to describe a specific instance of this
|
||||
// metric type. For example, the
|
||||
// `compute.googleapis.com/instance/network/received_bytes_count` metric type
|
||||
// has a label, `loadbalanced`, that specifies whether the traffic was
|
||||
// received through a load balanced IP address.
|
||||
repeated LabelDescriptor labels = 2;
|
||||
|
||||
// Whether the metric records instantaneous values, changes to a value, etc.
|
||||
MetricKind metric_kind = 3;
|
||||
|
||||
// Whether the measurement is an integer, a floating-point number, etc.
|
||||
ValueType value_type = 4;
|
||||
|
||||
// The unit in which the metric value is reported. It is only applicable
|
||||
// if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The
|
||||
// supported units are a subset of [The Unified Code for Units of
|
||||
// Measure](http://unitsofmeasure.org/ucum.html) standard:
|
||||
//
|
||||
// **Basic units (UNIT)**
|
||||
//
|
||||
// * `bit` bit
|
||||
// * `By` byte
|
||||
// * `s` second
|
||||
// * `min` minute
|
||||
// * `h` hour
|
||||
// * `d` day
|
||||
//
|
||||
// **Prefixes (PREFIX)**
|
||||
//
|
||||
// * `k` kilo (10**3)
|
||||
// * `M` mega (10**6)
|
||||
// * `G` giga (10**9)
|
||||
// * `T` tera (10**12)
|
||||
// * `P` peta (10**15)
|
||||
// * `E` exa (10**18)
|
||||
// * `Z` zetta (10**21)
|
||||
// * `Y` yotta (10**24)
|
||||
// * `m` milli (10**-3)
|
||||
// * `u` micro (10**-6)
|
||||
// * `n` nano (10**-9)
|
||||
// * `p` pico (10**-12)
|
||||
// * `f` femto (10**-15)
|
||||
// * `a` atto (10**-18)
|
||||
// * `z` zepto (10**-21)
|
||||
// * `y` yocto (10**-24)
|
||||
// * `Ki` kibi (2**10)
|
||||
// * `Mi` mebi (2**20)
|
||||
// * `Gi` gibi (2**30)
|
||||
// * `Ti` tebi (2**40)
|
||||
//
|
||||
// **Grammar**
|
||||
//
|
||||
// The grammar includes the dimensionless unit `1`, such as `1/s`.
|
||||
//
|
||||
// The grammar also includes these connectors:
|
||||
//
|
||||
// * `/` division (as an infix operator, e.g. `1/s`).
|
||||
// * `.` multiplication (as an infix operator, e.g. `GBy.d`)
|
||||
//
|
||||
// The grammar for a unit is as follows:
|
||||
//
|
||||
// Expression = Component { "." Component } { "/" Component } ;
|
||||
//
|
||||
// Component = [ PREFIX ] UNIT [ Annotation ]
|
||||
// | Annotation
|
||||
// | "1"
|
||||
// ;
|
||||
//
|
||||
// Annotation = "{" NAME "}" ;
|
||||
//
|
||||
// Notes:
|
||||
//
|
||||
// * `Annotation` is just a comment if it follows a `UNIT` and is
|
||||
// equivalent to `1` if it is used alone. For examples,
|
||||
// `{requests}/s == 1/s`, `By{transmitted}/s == By/s`.
|
||||
// * `NAME` is a sequence of non-blank printable ASCII characters not
|
||||
// containing '{' or '}'.
|
||||
string unit = 5;
|
||||
|
||||
// A detailed description of the metric, which can be used in documentation.
|
||||
string description = 6;
|
||||
|
||||
// A concise name for the metric, which can be displayed in user interfaces.
|
||||
// Use sentence case without an ending period, for example "Request count".
|
||||
string display_name = 7;
|
||||
}
|
||||
|
||||
// A specific metric identified by specifying values for all of the
|
||||
// labels of a [`MetricDescriptor`][google.api.MetricDescriptor].
|
||||
message Metric {
|
||||
// An existing metric type, see [google.api.MetricDescriptor][google.api.MetricDescriptor].
|
||||
// For example, `compute.googleapis.com/instance/cpu/usage_time`.
|
||||
string type = 3;
|
||||
|
||||
// The set of labels that uniquely identify a metric. To specify a
|
||||
// metric, all labels enumerated in the `MetricDescriptor` must be
|
||||
// assigned values.
|
||||
map<string, string> labels = 2;
|
||||
}
|
148
vendor/google.golang.org/genproto/googleapis/api/monitoredres/monitored_resource.pb.go
generated
vendored
Normal file
148
vendor/google.golang.org/genproto/googleapis/api/monitoredres/monitored_resource.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,148 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/monitoredres/monitored_resource.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package monitoredres is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
google.golang.org/genproto/googleapis/api/monitoredres/monitored_resource.proto
|
||||
|
||||
It has these top-level messages:
|
||||
MonitoredResourceDescriptor
|
||||
MonitoredResource
|
||||
*/
|
||||
package monitoredres // import "google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import google_api "google.golang.org/genproto/googleapis/api/label"
|
||||
|
||||
// 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
|
||||
|
||||
// An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object using a
|
||||
// type name and a set of labels. For example, the monitored resource
|
||||
// descriptor for Google Compute Engine VM instances has a type of
|
||||
// `"gce_instance"` and specifies the use of the labels `"instance_id"` and
|
||||
// `"zone"` to identify particular VM instances.
|
||||
//
|
||||
// Different APIs can support different monitored resource types. APIs generally
|
||||
// provide a `list` method that returns the monitored resource descriptors used
|
||||
// by the API.
|
||||
type MonitoredResourceDescriptor struct {
|
||||
// Optional. The resource name of the monitored resource descriptor:
|
||||
// `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
|
||||
// {type} is the value of the `type` field in this object and
|
||||
// {project_id} is a project ID that provides API-specific context for
|
||||
// accessing the type. APIs that do not use project information can use the
|
||||
// resource name format `"monitoredResourceDescriptors/{type}"`.
|
||||
Name string `protobuf:"bytes,5,opt,name=name" json:"name,omitempty"`
|
||||
// Required. The monitored resource type. For example, the type
|
||||
// `"cloudsql_database"` represents databases in Google Cloud SQL.
|
||||
// The maximum length of this value is 256 characters.
|
||||
Type string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"`
|
||||
// Optional. A concise name for the monitored resource type that might be
|
||||
// displayed in user interfaces. It should be a Title Cased Noun Phrase,
|
||||
// without any article or other determiners. For example,
|
||||
// `"Google Cloud SQL Database"`.
|
||||
DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName" json:"display_name,omitempty"`
|
||||
// Optional. A detailed description of the monitored resource type that might
|
||||
// be used in documentation.
|
||||
Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
|
||||
// Required. A set of labels used to describe instances of this monitored
|
||||
// resource type. For example, an individual Google Cloud SQL database is
|
||||
// identified by values for the labels `"database_id"` and `"zone"`.
|
||||
Labels []*google_api.LabelDescriptor `protobuf:"bytes,4,rep,name=labels" json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MonitoredResourceDescriptor) Reset() { *m = MonitoredResourceDescriptor{} }
|
||||
func (m *MonitoredResourceDescriptor) String() string { return proto.CompactTextString(m) }
|
||||
func (*MonitoredResourceDescriptor) ProtoMessage() {}
|
||||
func (*MonitoredResourceDescriptor) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *MonitoredResourceDescriptor) GetLabels() []*google_api.LabelDescriptor {
|
||||
if m != nil {
|
||||
return m.Labels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// An object representing a resource that can be used for monitoring, logging,
|
||||
// billing, or other purposes. Examples include virtual machine instances,
|
||||
// databases, and storage devices such as disks. The `type` field identifies a
|
||||
// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object that describes the resource's
|
||||
// schema. Information in the `labels` field identifies the actual resource and
|
||||
// its attributes according to the schema. For example, a particular Compute
|
||||
// Engine VM instance could be represented by the following object, because the
|
||||
// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for `"gce_instance"` has labels
|
||||
// `"instance_id"` and `"zone"`:
|
||||
//
|
||||
// { "type": "gce_instance",
|
||||
// "labels": { "instance_id": "12345678901234",
|
||||
// "zone": "us-central1-a" }}
|
||||
type MonitoredResource struct {
|
||||
// Required. The monitored resource type. This field must match
|
||||
// the `type` field of a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For
|
||||
// example, the type of a Cloud SQL database is `"cloudsql_database"`.
|
||||
Type string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"`
|
||||
// Required. Values for all of the labels listed in the associated monitored
|
||||
// resource descriptor. For example, Cloud SQL databases use the labels
|
||||
// `"database_id"` and `"zone"`.
|
||||
Labels map[string]string `protobuf:"bytes,2,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
}
|
||||
|
||||
func (m *MonitoredResource) Reset() { *m = MonitoredResource{} }
|
||||
func (m *MonitoredResource) String() string { return proto.CompactTextString(m) }
|
||||
func (*MonitoredResource) ProtoMessage() {}
|
||||
func (*MonitoredResource) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
func (m *MonitoredResource) GetLabels() map[string]string {
|
||||
if m != nil {
|
||||
return m.Labels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MonitoredResourceDescriptor)(nil), "google.api.MonitoredResourceDescriptor")
|
||||
proto.RegisterType((*MonitoredResource)(nil), "google.api.MonitoredResource")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/monitoredres/monitored_resource.proto", fileDescriptor0)
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 324 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xf2, 0x4f, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0x4b, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0xcb, 0x2f, 0x4a, 0xd7, 0x4f, 0x4f,
|
||||
0xcd, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x87, 0x48, 0x25, 0x16, 0x64, 0x16, 0xeb, 0x03, 0x09,
|
||||
0xfd, 0xdc, 0xfc, 0xbc, 0xcc, 0x92, 0xfc, 0xa2, 0xd4, 0x94, 0xa2, 0xd4, 0x62, 0x04, 0x27, 0x1e,
|
||||
0xc8, 0xcb, 0x2f, 0x2d, 0x4a, 0x4e, 0xd5, 0x03, 0x6b, 0x12, 0xe2, 0x82, 0x1a, 0x08, 0xd4, 0x21,
|
||||
0x65, 0x4d, 0xbc, 0xe1, 0x39, 0x89, 0x49, 0xa9, 0x39, 0x10, 0x12, 0x62, 0x90, 0xd2, 0x7e, 0x46,
|
||||
0x2e, 0x69, 0x5f, 0x98, 0x2d, 0x41, 0x50, 0x4b, 0x5c, 0x52, 0x8b, 0x93, 0x8b, 0x32, 0x0b, 0x80,
|
||||
0x62, 0x42, 0x42, 0x5c, 0x2c, 0x79, 0x89, 0xb9, 0xa9, 0x12, 0xac, 0x0a, 0x8c, 0x1a, 0x9c, 0x41,
|
||||
0x60, 0x36, 0x48, 0xac, 0xa4, 0xb2, 0x20, 0x55, 0x82, 0x11, 0x22, 0x06, 0x62, 0x0b, 0x29, 0x72,
|
||||
0xf1, 0xa4, 0x64, 0x16, 0x17, 0xe4, 0x24, 0x56, 0xc6, 0x83, 0xd5, 0x33, 0x81, 0xe5, 0xb8, 0xa1,
|
||||
0x62, 0x7e, 0x20, 0x6d, 0x0a, 0x5c, 0xdc, 0x29, 0x50, 0x83, 0x33, 0xf3, 0xf3, 0x24, 0x98, 0xa1,
|
||||
0x2a, 0x10, 0x42, 0x42, 0xc6, 0x5c, 0x6c, 0x60, 0xb7, 0x15, 0x4b, 0xb0, 0x28, 0x30, 0x6b, 0x70,
|
||||
0x1b, 0x49, 0xeb, 0x21, 0xbc, 0xa9, 0xe7, 0x03, 0x92, 0x41, 0xb8, 0x2c, 0x08, 0xaa, 0x54, 0x69,
|
||||
0x29, 0x23, 0x97, 0x20, 0x86, 0x0f, 0xb0, 0xba, 0xd1, 0x11, 0x6e, 0x3c, 0x13, 0xd8, 0x78, 0x4d,
|
||||
0x64, 0xe3, 0x31, 0x8c, 0x80, 0x58, 0x58, 0xec, 0x9a, 0x57, 0x52, 0x54, 0x09, 0xb3, 0x4c, 0xca,
|
||||
0x92, 0x8b, 0x1b, 0x49, 0x58, 0x48, 0x80, 0x8b, 0x39, 0x3b, 0xb5, 0x12, 0x6a, 0x09, 0x88, 0x29,
|
||||
0x24, 0xc2, 0xc5, 0x5a, 0x96, 0x98, 0x53, 0x0a, 0x0b, 0x00, 0x08, 0xc7, 0x8a, 0xc9, 0x82, 0xd1,
|
||||
0x29, 0x87, 0x8b, 0x2f, 0x39, 0x3f, 0x17, 0xc9, 0x4a, 0x27, 0x31, 0x0c, 0x3b, 0x03, 0x40, 0x71,
|
||||
0x12, 0xc0, 0x18, 0x65, 0x46, 0x5e, 0x7a, 0xf9, 0xc1, 0xc8, 0xb8, 0x88, 0x89, 0xc5, 0xdd, 0x31,
|
||||
0xc0, 0x33, 0x89, 0x0d, 0xac, 0xd8, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x6b, 0x87, 0xa2, 0x37,
|
||||
0x7a, 0x02, 0x00, 0x00,
|
||||
}
|
91
vendor/google.golang.org/genproto/googleapis/api/monitoredres/monitored_resource.proto
generated
vendored
Normal file
91
vendor/google.golang.org/genproto/googleapis/api/monitoredres/monitored_resource.proto
generated
vendored
Normal file
|
@ -0,0 +1,91 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
import "google.golang.org/genproto/googleapis/api/label/label.proto"; // from google/api/label.proto
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "MonitoredResourceProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
option go_package = "google.golang.org/genproto/googleapis/api/monitoredres";
|
||||
|
||||
// An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object using a
|
||||
// type name and a set of labels. For example, the monitored resource
|
||||
// descriptor for Google Compute Engine VM instances has a type of
|
||||
// `"gce_instance"` and specifies the use of the labels `"instance_id"` and
|
||||
// `"zone"` to identify particular VM instances.
|
||||
//
|
||||
// Different APIs can support different monitored resource types. APIs generally
|
||||
// provide a `list` method that returns the monitored resource descriptors used
|
||||
// by the API.
|
||||
message MonitoredResourceDescriptor {
|
||||
// Optional. The resource name of the monitored resource descriptor:
|
||||
// `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
|
||||
// {type} is the value of the `type` field in this object and
|
||||
// {project_id} is a project ID that provides API-specific context for
|
||||
// accessing the type. APIs that do not use project information can use the
|
||||
// resource name format `"monitoredResourceDescriptors/{type}"`.
|
||||
string name = 5;
|
||||
|
||||
// Required. The monitored resource type. For example, the type
|
||||
// `"cloudsql_database"` represents databases in Google Cloud SQL.
|
||||
// The maximum length of this value is 256 characters.
|
||||
string type = 1;
|
||||
|
||||
// Optional. A concise name for the monitored resource type that might be
|
||||
// displayed in user interfaces. It should be a Title Cased Noun Phrase,
|
||||
// without any article or other determiners. For example,
|
||||
// `"Google Cloud SQL Database"`.
|
||||
string display_name = 2;
|
||||
|
||||
// Optional. A detailed description of the monitored resource type that might
|
||||
// be used in documentation.
|
||||
string description = 3;
|
||||
|
||||
// Required. A set of labels used to describe instances of this monitored
|
||||
// resource type. For example, an individual Google Cloud SQL database is
|
||||
// identified by values for the labels `"database_id"` and `"zone"`.
|
||||
repeated LabelDescriptor labels = 4;
|
||||
}
|
||||
|
||||
// An object representing a resource that can be used for monitoring, logging,
|
||||
// billing, or other purposes. Examples include virtual machine instances,
|
||||
// databases, and storage devices such as disks. The `type` field identifies a
|
||||
// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object that describes the resource's
|
||||
// schema. Information in the `labels` field identifies the actual resource and
|
||||
// its attributes according to the schema. For example, a particular Compute
|
||||
// Engine VM instance could be represented by the following object, because the
|
||||
// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for `"gce_instance"` has labels
|
||||
// `"instance_id"` and `"zone"`:
|
||||
//
|
||||
// { "type": "gce_instance",
|
||||
// "labels": { "instance_id": "12345678901234",
|
||||
// "zone": "us-central1-a" }}
|
||||
message MonitoredResource {
|
||||
// Required. The monitored resource type. This field must match
|
||||
// the `type` field of a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For
|
||||
// example, the type of a Cloud SQL database is `"cloudsql_database"`.
|
||||
string type = 1;
|
||||
|
||||
// Required. Values for all of the labels listed in the associated monitored
|
||||
// resource descriptor. For example, Cloud SQL databases use the labels
|
||||
// `"database_id"` and `"zone"`.
|
||||
map<string, string> labels = 2;
|
||||
}
|
108
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/annotations.pb.go
generated
vendored
Normal file
108
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/annotations.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,108 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package google_api is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto
|
||||
google.golang.org/genproto/googleapis/api/serviceconfig/auth.proto
|
||||
google.golang.org/genproto/googleapis/api/serviceconfig/backend.proto
|
||||
google.golang.org/genproto/googleapis/api/serviceconfig/billing.proto
|
||||
google.golang.org/genproto/googleapis/api/serviceconfig/consumer.proto
|
||||
google.golang.org/genproto/googleapis/api/serviceconfig/context.proto
|
||||
google.golang.org/genproto/googleapis/api/serviceconfig/control.proto
|
||||
google.golang.org/genproto/googleapis/api/serviceconfig/documentation.proto
|
||||
google.golang.org/genproto/googleapis/api/serviceconfig/endpoint.proto
|
||||
google.golang.org/genproto/googleapis/api/serviceconfig/http.proto
|
||||
google.golang.org/genproto/googleapis/api/serviceconfig/log.proto
|
||||
google.golang.org/genproto/googleapis/api/serviceconfig/logging.proto
|
||||
google.golang.org/genproto/googleapis/api/serviceconfig/monitoring.proto
|
||||
google.golang.org/genproto/googleapis/api/serviceconfig/service.proto
|
||||
google.golang.org/genproto/googleapis/api/serviceconfig/system_parameter.proto
|
||||
google.golang.org/genproto/googleapis/api/serviceconfig/usage.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Authentication
|
||||
AuthenticationRule
|
||||
AuthProvider
|
||||
OAuthRequirements
|
||||
AuthRequirement
|
||||
Backend
|
||||
BackendRule
|
||||
Billing
|
||||
BillingStatusRule
|
||||
ProjectProperties
|
||||
Property
|
||||
Context
|
||||
ContextRule
|
||||
Control
|
||||
Documentation
|
||||
DocumentationRule
|
||||
Page
|
||||
Endpoint
|
||||
Http
|
||||
HttpRule
|
||||
CustomHttpPattern
|
||||
LogDescriptor
|
||||
Logging
|
||||
Monitoring
|
||||
Service
|
||||
SystemParameters
|
||||
SystemParameterRule
|
||||
SystemParameter
|
||||
Usage
|
||||
UsageRule
|
||||
*/
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import google_protobuf "google.golang.org/genproto/protobuf"
|
||||
|
||||
// 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
|
||||
|
||||
var E_Http = &proto.ExtensionDesc{
|
||||
ExtendedType: (*google_protobuf.MethodOptions)(nil),
|
||||
ExtensionType: (*HttpRule)(nil),
|
||||
Field: 72295728,
|
||||
Name: "google.api.http",
|
||||
Tag: "bytes,72295728,opt,name=http",
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterExtension(E_Http)
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto", fileDescriptor0)
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 211 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xf2, 0x4c, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0x4b, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0xcb, 0x2f, 0x4a, 0xd7, 0x4f, 0x4f,
|
||||
0xcd, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x87, 0x48, 0x25, 0x16, 0x64, 0x16, 0xeb, 0x03, 0x09,
|
||||
0xfd, 0xe2, 0xd4, 0xa2, 0xb2, 0xcc, 0xe4, 0xd4, 0xe4, 0xfc, 0xbc, 0xb4, 0xcc, 0x74, 0xfd, 0xc4,
|
||||
0xbc, 0xbc, 0xfc, 0x92, 0xc4, 0x92, 0xcc, 0xfc, 0xbc, 0x62, 0x3d, 0xb0, 0x72, 0x21, 0x2e, 0xa8,
|
||||
0x51, 0x40, 0xb5, 0x52, 0x4e, 0xe4, 0x1a, 0x9b, 0x51, 0x52, 0x52, 0x00, 0x31, 0x4f, 0xca, 0x04,
|
||||
0x8f, 0x19, 0x60, 0x32, 0xa9, 0x34, 0x4d, 0x3f, 0x25, 0xb5, 0x38, 0xb9, 0x28, 0xb3, 0xa0, 0x24,
|
||||
0xbf, 0x08, 0xa2, 0xcb, 0xca, 0x9b, 0x8b, 0x05, 0x64, 0x86, 0x90, 0x9c, 0x1e, 0x54, 0x3b, 0x4c,
|
||||
0xa9, 0x9e, 0x6f, 0x6a, 0x49, 0x46, 0x7e, 0x8a, 0x7f, 0x01, 0xd8, 0xcd, 0x12, 0x1b, 0x4e, 0xed,
|
||||
0x51, 0x52, 0x60, 0xd4, 0xe0, 0x36, 0x12, 0xd1, 0x43, 0xb8, 0x5b, 0xcf, 0x03, 0xa8, 0x35, 0xa8,
|
||||
0x34, 0x27, 0x35, 0x08, 0x6c, 0x88, 0x93, 0x36, 0x17, 0x5f, 0x72, 0x7e, 0x2e, 0x92, 0x02, 0x27,
|
||||
0x01, 0x47, 0x84, 0xbf, 0x03, 0x40, 0x26, 0x07, 0x30, 0x2e, 0x62, 0x62, 0x71, 0x77, 0x0c, 0xf0,
|
||||
0x4c, 0x62, 0x03, 0xdb, 0x64, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x01, 0xd8, 0x8e, 0xc1, 0x53,
|
||||
0x01, 0x00, 0x00,
|
||||
}
|
30
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto
generated
vendored
Normal file
30
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
// Copyright (c) 2015, Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/http.proto"; // from google/api/http.proto
|
||||
import "google.golang.org/genproto/protobuf/descriptor.proto"; // from google/protobuf/descriptor.proto
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "AnnotationsProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
extend google.protobuf.MethodOptions {
|
||||
// See `HttpRule`.
|
||||
HttpRule http = 72295728;
|
||||
}
|
242
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/auth.pb.go
generated
vendored
Normal file
242
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/auth.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,242 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/serviceconfig/auth.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
|
||||
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
|
||||
|
||||
// `Authentication` defines the authentication configuration for an API.
|
||||
//
|
||||
// Example for an API targeted for external use:
|
||||
//
|
||||
// name: calendar.googleapis.com
|
||||
// authentication:
|
||||
// rules:
|
||||
// - selector: "*"
|
||||
// oauth:
|
||||
// canonical_scopes: https://www.googleapis.com/auth/calendar
|
||||
//
|
||||
// - selector: google.calendar.Delegate
|
||||
// oauth:
|
||||
// canonical_scopes: https://www.googleapis.com/auth/calendar.read
|
||||
type Authentication struct {
|
||||
// A list of authentication rules that apply to individual API methods.
|
||||
//
|
||||
// **NOTE:** All service configuration rules follow "last one wins" order.
|
||||
Rules []*AuthenticationRule `protobuf:"bytes,3,rep,name=rules" json:"rules,omitempty"`
|
||||
// Defines a set of authentication providers that a service supports.
|
||||
Providers []*AuthProvider `protobuf:"bytes,4,rep,name=providers" json:"providers,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Authentication) Reset() { *m = Authentication{} }
|
||||
func (m *Authentication) String() string { return proto.CompactTextString(m) }
|
||||
func (*Authentication) ProtoMessage() {}
|
||||
func (*Authentication) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
|
||||
|
||||
func (m *Authentication) GetRules() []*AuthenticationRule {
|
||||
if m != nil {
|
||||
return m.Rules
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Authentication) GetProviders() []*AuthProvider {
|
||||
if m != nil {
|
||||
return m.Providers
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Authentication rules for the service.
|
||||
//
|
||||
// By default, if a method has any authentication requirements, every request
|
||||
// must include a valid credential matching one of the requirements.
|
||||
// It's an error to include more than one kind of credential in a single
|
||||
// request.
|
||||
//
|
||||
// If a method doesn't have any auth requirements, request credentials will be
|
||||
// ignored.
|
||||
type AuthenticationRule struct {
|
||||
// Selects the methods to which this rule applies.
|
||||
//
|
||||
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
||||
Selector string `protobuf:"bytes,1,opt,name=selector" json:"selector,omitempty"`
|
||||
// The requirements for OAuth credentials.
|
||||
Oauth *OAuthRequirements `protobuf:"bytes,2,opt,name=oauth" json:"oauth,omitempty"`
|
||||
// Whether to allow requests without a credential. The credential can be
|
||||
// an OAuth token, Google cookies (first-party auth) or EndUserCreds.
|
||||
//
|
||||
// For requests without credentials, if the service control environment is
|
||||
// specified, each incoming request **must** be associated with a service
|
||||
// consumer. This can be done by passing an API key that belongs to a consumer
|
||||
// project.
|
||||
AllowWithoutCredential bool `protobuf:"varint,5,opt,name=allow_without_credential,json=allowWithoutCredential" json:"allow_without_credential,omitempty"`
|
||||
// Requirements for additional authentication providers.
|
||||
Requirements []*AuthRequirement `protobuf:"bytes,7,rep,name=requirements" json:"requirements,omitempty"`
|
||||
}
|
||||
|
||||
func (m *AuthenticationRule) Reset() { *m = AuthenticationRule{} }
|
||||
func (m *AuthenticationRule) String() string { return proto.CompactTextString(m) }
|
||||
func (*AuthenticationRule) ProtoMessage() {}
|
||||
func (*AuthenticationRule) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} }
|
||||
|
||||
func (m *AuthenticationRule) GetOauth() *OAuthRequirements {
|
||||
if m != nil {
|
||||
return m.Oauth
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AuthenticationRule) GetRequirements() []*AuthRequirement {
|
||||
if m != nil {
|
||||
return m.Requirements
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Configuration for an anthentication provider, including support for
|
||||
// [JSON Web Token (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
|
||||
type AuthProvider struct {
|
||||
// The unique identifier of the auth provider. It will be referred to by
|
||||
// `AuthRequirement.provider_id`.
|
||||
//
|
||||
// Example: "bookstore_auth".
|
||||
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
|
||||
// Identifies the principal that issued the JWT. See
|
||||
// https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1
|
||||
// Usually a URL or an email address.
|
||||
//
|
||||
// Example: https://securetoken.google.com
|
||||
// Example: 1234567-compute@developer.gserviceaccount.com
|
||||
Issuer string `protobuf:"bytes,2,opt,name=issuer" json:"issuer,omitempty"`
|
||||
// URL of the provider's public key set to validate signature of the JWT. See
|
||||
// [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).
|
||||
// Optional if the key set document:
|
||||
// - can be retrieved from
|
||||
// [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html
|
||||
// of the issuer.
|
||||
// - can be inferred from the email domain of the issuer (e.g. a Google service account).
|
||||
//
|
||||
// Example: https://www.googleapis.com/oauth2/v1/certs
|
||||
JwksUri string `protobuf:"bytes,3,opt,name=jwks_uri,json=jwksUri" json:"jwks_uri,omitempty"`
|
||||
}
|
||||
|
||||
func (m *AuthProvider) Reset() { *m = AuthProvider{} }
|
||||
func (m *AuthProvider) String() string { return proto.CompactTextString(m) }
|
||||
func (*AuthProvider) ProtoMessage() {}
|
||||
func (*AuthProvider) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} }
|
||||
|
||||
// OAuth scopes are a way to define data and permissions on data. For example,
|
||||
// there are scopes defined for "Read-only access to Google Calendar" and
|
||||
// "Access to Cloud Platform". Users can consent to a scope for an application,
|
||||
// giving it permission to access that data on their behalf.
|
||||
//
|
||||
// OAuth scope specifications should be fairly coarse grained; a user will need
|
||||
// to see and understand the text description of what your scope means.
|
||||
//
|
||||
// In most cases: use one or at most two OAuth scopes for an entire family of
|
||||
// products. If your product has multiple APIs, you should probably be sharing
|
||||
// the OAuth scope across all of those APIs.
|
||||
//
|
||||
// When you need finer grained OAuth consent screens: talk with your product
|
||||
// management about how developers will use them in practice.
|
||||
//
|
||||
// Please note that even though each of the canonical scopes is enough for a
|
||||
// request to be accepted and passed to the backend, a request can still fail
|
||||
// due to the backend requiring additional scopes or permissions.
|
||||
type OAuthRequirements struct {
|
||||
// The list of publicly documented OAuth scopes that are allowed access. An
|
||||
// OAuth token containing any of these scopes will be accepted.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// canonical_scopes: https://www.googleapis.com/auth/calendar,
|
||||
// https://www.googleapis.com/auth/calendar.read
|
||||
CanonicalScopes string `protobuf:"bytes,1,opt,name=canonical_scopes,json=canonicalScopes" json:"canonical_scopes,omitempty"`
|
||||
}
|
||||
|
||||
func (m *OAuthRequirements) Reset() { *m = OAuthRequirements{} }
|
||||
func (m *OAuthRequirements) String() string { return proto.CompactTextString(m) }
|
||||
func (*OAuthRequirements) ProtoMessage() {}
|
||||
func (*OAuthRequirements) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} }
|
||||
|
||||
// User-defined authentication requirements, including support for
|
||||
// [JSON Web Token (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
|
||||
type AuthRequirement struct {
|
||||
// [id][google.api.AuthProvider.id] from authentication provider.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// provider_id: bookstore_auth
|
||||
ProviderId string `protobuf:"bytes,1,opt,name=provider_id,json=providerId" json:"provider_id,omitempty"`
|
||||
// The list of JWT
|
||||
// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
|
||||
// that are allowed to access. A JWT containing any of these audiences will
|
||||
// be accepted. When this setting is absent, only JWTs with audience
|
||||
// "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]"
|
||||
// will be accepted. For example, if no audiences are in the setting,
|
||||
// LibraryService API will only accept JWTs with the following audience
|
||||
// "https://library-example.googleapis.com/google.example.library.v1.LibraryService".
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// audiences: bookstore_android.apps.googleusercontent.com,
|
||||
// bookstore_web.apps.googleusercontent.com
|
||||
Audiences string `protobuf:"bytes,2,opt,name=audiences" json:"audiences,omitempty"`
|
||||
}
|
||||
|
||||
func (m *AuthRequirement) Reset() { *m = AuthRequirement{} }
|
||||
func (m *AuthRequirement) String() string { return proto.CompactTextString(m) }
|
||||
func (*AuthRequirement) ProtoMessage() {}
|
||||
func (*AuthRequirement) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{4} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Authentication)(nil), "google.api.Authentication")
|
||||
proto.RegisterType((*AuthenticationRule)(nil), "google.api.AuthenticationRule")
|
||||
proto.RegisterType((*AuthProvider)(nil), "google.api.AuthProvider")
|
||||
proto.RegisterType((*OAuthRequirements)(nil), "google.api.OAuthRequirements")
|
||||
proto.RegisterType((*AuthRequirement)(nil), "google.api.AuthRequirement")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/serviceconfig/auth.proto", fileDescriptor1)
|
||||
}
|
||||
|
||||
var fileDescriptor1 = []byte{
|
||||
// 425 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x52, 0x4d, 0x6f, 0x13, 0x31,
|
||||
0x10, 0x55, 0xd2, 0xa6, 0xcd, 0x4e, 0xaa, 0x14, 0x7c, 0xa8, 0x4c, 0xf9, 0xaa, 0x56, 0x1c, 0xca,
|
||||
0x65, 0x57, 0x6a, 0x11, 0xe2, 0x04, 0x6a, 0x38, 0xa0, 0x9c, 0x08, 0x46, 0x88, 0xe3, 0xca, 0x78,
|
||||
0xcd, 0xd6, 0xe0, 0x7a, 0x82, 0xed, 0x6d, 0x6e, 0xfc, 0x18, 0x7e, 0x19, 0x3f, 0x05, 0xaf, 0x77,
|
||||
0x9b, 0x6c, 0x93, 0x1b, 0x97, 0x28, 0x33, 0xef, 0xcd, 0x7b, 0x7e, 0x33, 0x0b, 0xb3, 0x0a, 0xb1,
|
||||
0xd2, 0x32, 0xab, 0x50, 0x73, 0x53, 0x65, 0x68, 0xab, 0xbc, 0x92, 0x66, 0x69, 0xd1, 0x63, 0xde,
|
||||
0x42, 0x7c, 0xa9, 0x5c, 0x1e, 0x7e, 0x72, 0x27, 0xed, 0xad, 0x12, 0x52, 0xa0, 0xf9, 0xae, 0xaa,
|
||||
0x9c, 0xd7, 0xfe, 0x3a, 0x8b, 0x3c, 0x02, 0x9d, 0x46, 0x20, 0x9d, 0xce, 0xff, 0x5b, 0xcf, 0x18,
|
||||
0xf4, 0xdc, 0x2b, 0x34, 0xae, 0x95, 0x4d, 0x7f, 0xc3, 0xf4, 0x2a, 0x98, 0x48, 0xe3, 0x95, 0x88,
|
||||
0x00, 0x79, 0x05, 0x23, 0x5b, 0x6b, 0xe9, 0xe8, 0xde, 0xd9, 0xde, 0xf9, 0xe4, 0xe2, 0x59, 0xb6,
|
||||
0x31, 0xce, 0xee, 0x53, 0x59, 0xa0, 0xb1, 0x96, 0x4c, 0x5e, 0x43, 0x12, 0x04, 0x6f, 0x55, 0x29,
|
||||
0xad, 0xa3, 0xfb, 0x71, 0x92, 0x6e, 0x4f, 0x2e, 0x3a, 0x02, 0xdb, 0x50, 0xd3, 0xbf, 0x03, 0x20,
|
||||
0xbb, 0xaa, 0xe4, 0x14, 0xc6, 0x4e, 0x6a, 0x29, 0x3c, 0x5a, 0x3a, 0x38, 0x1b, 0x9c, 0x27, 0x6c,
|
||||
0x5d, 0x93, 0x4b, 0x18, 0x61, 0xb3, 0x18, 0x3a, 0x0c, 0xc0, 0xe4, 0xe2, 0x69, 0xdf, 0xe6, 0x63,
|
||||
0xa3, 0xc5, 0xe4, 0xaf, 0x5a, 0x59, 0x79, 0x13, 0x34, 0x1d, 0x6b, 0xb9, 0xe4, 0x0d, 0x50, 0xae,
|
||||
0x35, 0xae, 0x8a, 0x95, 0xf2, 0xd7, 0x58, 0xfb, 0x42, 0x58, 0x59, 0x36, 0xa6, 0x5c, 0xd3, 0x51,
|
||||
0xd0, 0x19, 0xb3, 0x93, 0x88, 0x7f, 0x6d, 0xe1, 0xf7, 0x6b, 0x94, 0xbc, 0x83, 0x23, 0xdb, 0x13,
|
||||
0xa4, 0x87, 0x31, 0xdc, 0xe3, 0xed, 0x70, 0x3d, 0x53, 0x76, 0x6f, 0x20, 0xfd, 0x04, 0x47, 0xfd,
|
||||
0xf4, 0x64, 0x0a, 0x43, 0x55, 0x76, 0xa9, 0xc2, 0x3f, 0x72, 0x02, 0x07, 0xca, 0xb9, 0x5a, 0xda,
|
||||
0x18, 0x28, 0x61, 0x5d, 0x45, 0x1e, 0xc1, 0xf8, 0xc7, 0xea, 0xa7, 0x2b, 0x6a, 0xab, 0xc2, 0x2d,
|
||||
0x1a, 0xe4, 0xb0, 0xa9, 0xbf, 0x58, 0x95, 0xbe, 0x85, 0x87, 0x3b, 0x49, 0xc9, 0x4b, 0x78, 0x20,
|
||||
0xb8, 0x41, 0x13, 0xf6, 0xa8, 0x0b, 0x27, 0x70, 0x19, 0x6e, 0xd8, 0xba, 0x1c, 0xaf, 0xfb, 0x9f,
|
||||
0x63, 0x3b, 0x5d, 0xc0, 0xf1, 0xd6, 0x38, 0x79, 0x0e, 0x93, 0xbb, 0xab, 0x14, 0xeb, 0xe7, 0xc1,
|
||||
0x5d, 0x6b, 0x5e, 0x92, 0x27, 0x90, 0xf0, 0xba, 0x54, 0xd2, 0x88, 0xa0, 0xdb, 0xbe, 0x74, 0xd3,
|
||||
0x98, 0xbd, 0x80, 0xa9, 0xc0, 0x9b, 0xde, 0x52, 0x66, 0x49, 0x17, 0xda, 0xe3, 0x62, 0xf0, 0x67,
|
||||
0xb8, 0xff, 0xe1, 0x6a, 0x31, 0xff, 0x76, 0x10, 0x3f, 0xba, 0xcb, 0x7f, 0x01, 0x00, 0x00, 0xff,
|
||||
0xff, 0x0d, 0x41, 0xfd, 0x7a, 0x11, 0x03, 0x00, 0x00,
|
||||
}
|
164
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/auth.proto
generated
vendored
Normal file
164
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/auth.proto
generated
vendored
Normal file
|
@ -0,0 +1,164 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto"; // from google/api/annotations.proto
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "AuthProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
|
||||
// `Authentication` defines the authentication configuration for an API.
|
||||
//
|
||||
// Example for an API targeted for external use:
|
||||
//
|
||||
// name: calendar.googleapis.com
|
||||
// authentication:
|
||||
// rules:
|
||||
// - selector: "*"
|
||||
// oauth:
|
||||
// canonical_scopes: https://www.googleapis.com/auth/calendar
|
||||
//
|
||||
// - selector: google.calendar.Delegate
|
||||
// oauth:
|
||||
// canonical_scopes: https://www.googleapis.com/auth/calendar.read
|
||||
message Authentication {
|
||||
// A list of authentication rules that apply to individual API methods.
|
||||
//
|
||||
// **NOTE:** All service configuration rules follow "last one wins" order.
|
||||
repeated AuthenticationRule rules = 3;
|
||||
|
||||
// Defines a set of authentication providers that a service supports.
|
||||
repeated AuthProvider providers = 4;
|
||||
}
|
||||
|
||||
// Authentication rules for the service.
|
||||
//
|
||||
// By default, if a method has any authentication requirements, every request
|
||||
// must include a valid credential matching one of the requirements.
|
||||
// It's an error to include more than one kind of credential in a single
|
||||
// request.
|
||||
//
|
||||
// If a method doesn't have any auth requirements, request credentials will be
|
||||
// ignored.
|
||||
message AuthenticationRule {
|
||||
// Selects the methods to which this rule applies.
|
||||
//
|
||||
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
||||
string selector = 1;
|
||||
|
||||
// The requirements for OAuth credentials.
|
||||
OAuthRequirements oauth = 2;
|
||||
|
||||
// Whether to allow requests without a credential. The credential can be
|
||||
// an OAuth token, Google cookies (first-party auth) or EndUserCreds.
|
||||
//
|
||||
// For requests without credentials, if the service control environment is
|
||||
// specified, each incoming request **must** be associated with a service
|
||||
// consumer. This can be done by passing an API key that belongs to a consumer
|
||||
// project.
|
||||
bool allow_without_credential = 5;
|
||||
|
||||
// Requirements for additional authentication providers.
|
||||
repeated AuthRequirement requirements = 7;
|
||||
}
|
||||
|
||||
// Configuration for an anthentication provider, including support for
|
||||
// [JSON Web Token (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
|
||||
message AuthProvider {
|
||||
// The unique identifier of the auth provider. It will be referred to by
|
||||
// `AuthRequirement.provider_id`.
|
||||
//
|
||||
// Example: "bookstore_auth".
|
||||
string id = 1;
|
||||
|
||||
// Identifies the principal that issued the JWT. See
|
||||
// https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1
|
||||
// Usually a URL or an email address.
|
||||
//
|
||||
// Example: https://securetoken.google.com
|
||||
// Example: 1234567-compute@developer.gserviceaccount.com
|
||||
string issuer = 2;
|
||||
|
||||
// URL of the provider's public key set to validate signature of the JWT. See
|
||||
// [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).
|
||||
// Optional if the key set document:
|
||||
// - can be retrieved from
|
||||
// [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html
|
||||
// of the issuer.
|
||||
// - can be inferred from the email domain of the issuer (e.g. a Google service account).
|
||||
//
|
||||
// Example: https://www.googleapis.com/oauth2/v1/certs
|
||||
string jwks_uri = 3;
|
||||
}
|
||||
|
||||
// OAuth scopes are a way to define data and permissions on data. For example,
|
||||
// there are scopes defined for "Read-only access to Google Calendar" and
|
||||
// "Access to Cloud Platform". Users can consent to a scope for an application,
|
||||
// giving it permission to access that data on their behalf.
|
||||
//
|
||||
// OAuth scope specifications should be fairly coarse grained; a user will need
|
||||
// to see and understand the text description of what your scope means.
|
||||
//
|
||||
// In most cases: use one or at most two OAuth scopes for an entire family of
|
||||
// products. If your product has multiple APIs, you should probably be sharing
|
||||
// the OAuth scope across all of those APIs.
|
||||
//
|
||||
// When you need finer grained OAuth consent screens: talk with your product
|
||||
// management about how developers will use them in practice.
|
||||
//
|
||||
// Please note that even though each of the canonical scopes is enough for a
|
||||
// request to be accepted and passed to the backend, a request can still fail
|
||||
// due to the backend requiring additional scopes or permissions.
|
||||
message OAuthRequirements {
|
||||
// The list of publicly documented OAuth scopes that are allowed access. An
|
||||
// OAuth token containing any of these scopes will be accepted.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// canonical_scopes: https://www.googleapis.com/auth/calendar,
|
||||
// https://www.googleapis.com/auth/calendar.read
|
||||
string canonical_scopes = 1;
|
||||
}
|
||||
|
||||
// User-defined authentication requirements, including support for
|
||||
// [JSON Web Token (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
|
||||
message AuthRequirement {
|
||||
// [id][google.api.AuthProvider.id] from authentication provider.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// provider_id: bookstore_auth
|
||||
string provider_id = 1;
|
||||
|
||||
// The list of JWT
|
||||
// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
|
||||
// that are allowed to access. A JWT containing any of these audiences will
|
||||
// be accepted. When this setting is absent, only JWTs with audience
|
||||
// "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]"
|
||||
// will be accepted. For example, if no audiences are in the setting,
|
||||
// LibraryService API will only accept JWTs with the following audience
|
||||
// "https://library-example.googleapis.com/google.example.library.v1.LibraryService".
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// audiences: bookstore_android.apps.googleusercontent.com,
|
||||
// bookstore_web.apps.googleusercontent.com
|
||||
string audiences = 2;
|
||||
}
|
79
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/backend.pb.go
generated
vendored
Normal file
79
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/backend.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/serviceconfig/backend.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
|
||||
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
|
||||
|
||||
// `Backend` defines the backend configuration for a service.
|
||||
type Backend struct {
|
||||
// A list of API backend rules that apply to individual API methods.
|
||||
//
|
||||
// **NOTE:** All service configuration rules follow "last one wins" order.
|
||||
Rules []*BackendRule `protobuf:"bytes,1,rep,name=rules" json:"rules,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Backend) Reset() { *m = Backend{} }
|
||||
func (m *Backend) String() string { return proto.CompactTextString(m) }
|
||||
func (*Backend) ProtoMessage() {}
|
||||
func (*Backend) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} }
|
||||
|
||||
func (m *Backend) GetRules() []*BackendRule {
|
||||
if m != nil {
|
||||
return m.Rules
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A backend rule provides configuration for an individual API element.
|
||||
type BackendRule struct {
|
||||
// Selects the methods to which this rule applies.
|
||||
//
|
||||
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
||||
Selector string `protobuf:"bytes,1,opt,name=selector" json:"selector,omitempty"`
|
||||
// The address of the API backend.
|
||||
Address string `protobuf:"bytes,2,opt,name=address" json:"address,omitempty"`
|
||||
// The number of seconds to wait for a response from a request. The
|
||||
// default depends on the deployment context.
|
||||
Deadline float64 `protobuf:"fixed64,3,opt,name=deadline" json:"deadline,omitempty"`
|
||||
}
|
||||
|
||||
func (m *BackendRule) Reset() { *m = BackendRule{} }
|
||||
func (m *BackendRule) String() string { return proto.CompactTextString(m) }
|
||||
func (*BackendRule) ProtoMessage() {}
|
||||
func (*BackendRule) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{1} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Backend)(nil), "google.api.Backend")
|
||||
proto.RegisterType((*BackendRule)(nil), "google.api.BackendRule")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/serviceconfig/backend.proto", fileDescriptor2)
|
||||
}
|
||||
|
||||
var fileDescriptor2 = []byte{
|
||||
// 217 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x4c, 0x8f, 0xcf, 0x4e, 0x03, 0x21,
|
||||
0x10, 0xc6, 0x43, 0xab, 0x56, 0xa7, 0xc6, 0x03, 0x17, 0x89, 0x27, 0xd3, 0x8b, 0xbd, 0x08, 0x89,
|
||||
0x5e, 0xbc, 0xba, 0x89, 0x31, 0xde, 0x36, 0xbc, 0x80, 0xa1, 0x30, 0x12, 0x22, 0x32, 0x0d, 0x54,
|
||||
0x1f, 0xc8, 0x27, 0x95, 0xfd, 0xe3, 0x76, 0x2f, 0x24, 0x1f, 0xbf, 0x1f, 0xc3, 0x7c, 0xf0, 0xe2,
|
||||
0x89, 0x7c, 0x44, 0xe9, 0x29, 0x9a, 0xe4, 0x25, 0x65, 0xaf, 0x3c, 0xa6, 0x7d, 0xa6, 0x03, 0xa9,
|
||||
0x01, 0x99, 0x7d, 0x28, 0xaa, 0x1e, 0xaa, 0x60, 0xfe, 0x09, 0x16, 0x2d, 0xa5, 0x8f, 0xe0, 0xd5,
|
||||
0xce, 0xd8, 0x4f, 0x4c, 0x4e, 0xf6, 0x2a, 0x87, 0x71, 0x4c, 0xf5, 0x36, 0x4f, 0xb0, 0x6a, 0x06,
|
||||
0xc8, 0xef, 0xe1, 0x34, 0x7f, 0x47, 0x2c, 0x82, 0xdd, 0x2e, 0xb7, 0xeb, 0x87, 0x6b, 0x79, 0xd4,
|
||||
0xe4, 0xe8, 0xe8, 0xca, 0xf5, 0x60, 0x6d, 0xde, 0x61, 0x3d, 0xbb, 0xe5, 0x37, 0x70, 0x5e, 0x30,
|
||||
0xa2, 0x3d, 0x50, 0xae, 0x03, 0xd8, 0xf6, 0x42, 0x4f, 0x99, 0x0b, 0x58, 0x19, 0xe7, 0x32, 0x96,
|
||||
0x22, 0x16, 0x3d, 0xfa, 0x8f, 0xdd, 0x2b, 0x87, 0xc6, 0xc5, 0x90, 0x50, 0x2c, 0x2b, 0x62, 0x7a,
|
||||
0xca, 0xcd, 0x1d, 0x5c, 0x59, 0xfa, 0x9a, 0x6d, 0xd1, 0x5c, 0x8e, 0x1f, 0xb6, 0x5d, 0x8d, 0x96,
|
||||
0xfd, 0x2e, 0x4e, 0x5e, 0x9f, 0xdb, 0xb7, 0xdd, 0x59, 0x5f, 0xeb, 0xf1, 0x2f, 0x00, 0x00, 0xff,
|
||||
0xff, 0x1b, 0xf2, 0x31, 0x3a, 0x1f, 0x01, 0x00, 0x00,
|
||||
}
|
46
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/backend.proto
generated
vendored
Normal file
46
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/backend.proto
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "BackendProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
|
||||
// `Backend` defines the backend configuration for a service.
|
||||
message Backend {
|
||||
// A list of API backend rules that apply to individual API methods.
|
||||
//
|
||||
// **NOTE:** All service configuration rules follow "last one wins" order.
|
||||
repeated BackendRule rules = 1;
|
||||
}
|
||||
|
||||
// A backend rule provides configuration for an individual API element.
|
||||
message BackendRule {
|
||||
// Selects the methods to which this rule applies.
|
||||
//
|
||||
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
||||
string selector = 1;
|
||||
|
||||
// The address of the API backend.
|
||||
string address = 2;
|
||||
|
||||
// The number of seconds to wait for a response from a request. The
|
||||
// default depends on the deployment context.
|
||||
double deadline = 3;
|
||||
}
|
131
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/billing.pb.go
generated
vendored
Normal file
131
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/billing.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,131 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/serviceconfig/billing.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "google.golang.org/genproto/googleapis/api/metric"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// Billing related configuration of the service.
|
||||
//
|
||||
// The following example shows how to configure metrics for billing:
|
||||
//
|
||||
// metrics:
|
||||
// - name: library.googleapis.com/read_calls
|
||||
// metric_kind: DELTA
|
||||
// value_type: INT64
|
||||
// - name: library.googleapis.com/write_calls
|
||||
// metric_kind: DELTA
|
||||
// value_type: INT64
|
||||
// billing:
|
||||
// metrics:
|
||||
// - library.googleapis.com/read_calls
|
||||
// - library.googleapis.com/write_calls
|
||||
//
|
||||
// The next example shows how to enable billing status check and customize the
|
||||
// check behavior. It makes sure billing status check is included in the `Check`
|
||||
// method of [Service Control API](https://cloud.google.com/service-control/).
|
||||
// In the example, "google.storage.Get" method can be served when the billing
|
||||
// status is either `current` or `delinquent`, while "google.storage.Write"
|
||||
// method can only be served when the billing status is `current`:
|
||||
//
|
||||
// billing:
|
||||
// rules:
|
||||
// - selector: google.storage.Get
|
||||
// allowed_statuses:
|
||||
// - current
|
||||
// - delinquent
|
||||
// - selector: google.storage.Write
|
||||
// allowed_statuses: current
|
||||
//
|
||||
// Mostly services should only allow `current` status when serving requests.
|
||||
// In addition, services can choose to allow both `current` and `delinquent`
|
||||
// statuses when serving read-only requests to resources. If there's no
|
||||
// matching selector for operation, no billing status check will be performed.
|
||||
//
|
||||
type Billing struct {
|
||||
// Names of the metrics to report to billing. Each name must
|
||||
// be defined in [Service.metrics][google.api.Service.metrics] section.
|
||||
Metrics []string `protobuf:"bytes,1,rep,name=metrics" json:"metrics,omitempty"`
|
||||
// A list of billing status rules for configuring billing status check.
|
||||
Rules []*BillingStatusRule `protobuf:"bytes,5,rep,name=rules" json:"rules,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Billing) Reset() { *m = Billing{} }
|
||||
func (m *Billing) String() string { return proto.CompactTextString(m) }
|
||||
func (*Billing) ProtoMessage() {}
|
||||
func (*Billing) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} }
|
||||
|
||||
func (m *Billing) GetRules() []*BillingStatusRule {
|
||||
if m != nil {
|
||||
return m.Rules
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Defines the billing status requirements for operations.
|
||||
//
|
||||
// When used with
|
||||
// [Service Control API](https://cloud.google.com/service-control/), the
|
||||
// following statuses are supported:
|
||||
//
|
||||
// - **current**: the associated billing account is up to date and capable of
|
||||
// paying for resource usages.
|
||||
// - **delinquent**: the associated billing account has a correctable problem,
|
||||
// such as late payment.
|
||||
//
|
||||
// Mostly services should only allow `current` status when serving requests.
|
||||
// In addition, services can choose to allow both `current` and `delinquent`
|
||||
// statuses when serving read-only requests to resources. If the list of
|
||||
// allowed_statuses is empty, it means no billing requirement.
|
||||
//
|
||||
type BillingStatusRule struct {
|
||||
// Selects the operation names to which this rule applies.
|
||||
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
||||
Selector string `protobuf:"bytes,1,opt,name=selector" json:"selector,omitempty"`
|
||||
// Allowed billing statuses. The billing status check passes if the actual
|
||||
// billing status matches any of the provided values here.
|
||||
AllowedStatuses []string `protobuf:"bytes,2,rep,name=allowed_statuses,json=allowedStatuses" json:"allowed_statuses,omitempty"`
|
||||
}
|
||||
|
||||
func (m *BillingStatusRule) Reset() { *m = BillingStatusRule{} }
|
||||
func (m *BillingStatusRule) String() string { return proto.CompactTextString(m) }
|
||||
func (*BillingStatusRule) ProtoMessage() {}
|
||||
func (*BillingStatusRule) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{1} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Billing)(nil), "google.api.Billing")
|
||||
proto.RegisterType((*BillingStatusRule)(nil), "google.api.BillingStatusRule")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/serviceconfig/billing.proto", fileDescriptor3)
|
||||
}
|
||||
|
||||
var fileDescriptor3 = []byte{
|
||||
// 245 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x4f, 0xbd, 0x4b, 0x43, 0x31,
|
||||
0x10, 0xe7, 0x29, 0xb5, 0x7a, 0x8a, 0x1f, 0x99, 0x1e, 0x0f, 0x84, 0xd2, 0x49, 0x97, 0x17, 0xb0,
|
||||
0xb3, 0xcb, 0x03, 0x07, 0xb7, 0xf2, 0xba, 0x88, 0x8b, 0xa4, 0xf1, 0x0c, 0x81, 0x34, 0x57, 0x92,
|
||||
0x54, 0xff, 0x7d, 0xcf, 0x24, 0x7e, 0x80, 0x8b, 0xb8, 0x24, 0xdc, 0xdd, 0xef, 0x13, 0xee, 0x0c,
|
||||
0x91, 0x71, 0xd8, 0x1b, 0x72, 0xca, 0x9b, 0x9e, 0x82, 0x91, 0x06, 0xfd, 0x36, 0x50, 0x22, 0x59,
|
||||
0x4e, 0x6a, 0x6b, 0xa3, 0xe4, 0x47, 0x46, 0x0c, 0xaf, 0x56, 0xa3, 0x26, 0xff, 0x62, 0x8d, 0x5c,
|
||||
0x5b, 0xe7, 0x2c, 0x33, 0x32, 0x54, 0x40, 0x95, 0x61, 0x5c, 0x77, 0xff, 0x5f, 0x49, 0xe5, 0x3d,
|
||||
0x25, 0x95, 0x2c, 0xf9, 0x58, 0x64, 0xbb, 0xdb, 0xbf, 0x4b, 0x6d, 0x30, 0x05, 0xab, 0xeb, 0x57,
|
||||
0xe8, 0xf3, 0x07, 0x98, 0x0e, 0x25, 0xa6, 0x68, 0x61, 0x5a, 0x4e, 0xb1, 0x6d, 0x66, 0xfb, 0x57,
|
||||
0x47, 0xe3, 0xe7, 0x28, 0x16, 0x30, 0x09, 0x3b, 0x87, 0xb1, 0x9d, 0xf0, 0xfe, 0xf8, 0xe6, 0xb2,
|
||||
0xff, 0xae, 0xd2, 0x57, 0xf6, 0x8a, 0x53, 0xed, 0xe2, 0xc8, 0xa8, 0xb1, 0x60, 0xe7, 0x8f, 0x70,
|
||||
0xf1, 0xeb, 0x26, 0x3a, 0x38, 0x8c, 0xe8, 0x50, 0x27, 0x0a, 0x6c, 0xd2, 0xb0, 0xc9, 0xd7, 0x2c,
|
||||
0xae, 0xe1, 0x5c, 0x39, 0x47, 0x6f, 0xf8, 0xfc, 0x14, 0x33, 0x83, 0x0d, 0xf7, 0x72, 0x90, 0xb3,
|
||||
0xba, 0x5f, 0xd5, 0xf5, 0x30, 0x83, 0x53, 0x4d, 0x9b, 0x1f, 0x31, 0x86, 0x93, 0xea, 0xb5, 0xfc,
|
||||
0x68, 0xb5, 0x6c, 0xd6, 0x07, 0xb9, 0xde, 0xe2, 0x3d, 0x00, 0x00, 0xff, 0xff, 0xe0, 0xe1, 0x19,
|
||||
0xb1, 0xbd, 0x01, 0x00, 0x00,
|
||||
}
|
97
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/billing.proto
generated
vendored
Normal file
97
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/billing.proto
generated
vendored
Normal file
|
@ -0,0 +1,97 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto"; // from google/api/annotations.proto
|
||||
import "google.golang.org/genproto/googleapis/api/metric/metric.proto"; // from google/api/metric.proto
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "BillingProto";
|
||||
option java_package = "com.google.api";
|
||||
|
||||
|
||||
// Billing related configuration of the service.
|
||||
//
|
||||
// The following example shows how to configure metrics for billing:
|
||||
//
|
||||
// metrics:
|
||||
// - name: library.googleapis.com/read_calls
|
||||
// metric_kind: DELTA
|
||||
// value_type: INT64
|
||||
// - name: library.googleapis.com/write_calls
|
||||
// metric_kind: DELTA
|
||||
// value_type: INT64
|
||||
// billing:
|
||||
// metrics:
|
||||
// - library.googleapis.com/read_calls
|
||||
// - library.googleapis.com/write_calls
|
||||
//
|
||||
// The next example shows how to enable billing status check and customize the
|
||||
// check behavior. It makes sure billing status check is included in the `Check`
|
||||
// method of [Service Control API](https://cloud.google.com/service-control/).
|
||||
// In the example, "google.storage.Get" method can be served when the billing
|
||||
// status is either `current` or `delinquent`, while "google.storage.Write"
|
||||
// method can only be served when the billing status is `current`:
|
||||
//
|
||||
// billing:
|
||||
// rules:
|
||||
// - selector: google.storage.Get
|
||||
// allowed_statuses:
|
||||
// - current
|
||||
// - delinquent
|
||||
// - selector: google.storage.Write
|
||||
// allowed_statuses: current
|
||||
//
|
||||
// Mostly services should only allow `current` status when serving requests.
|
||||
// In addition, services can choose to allow both `current` and `delinquent`
|
||||
// statuses when serving read-only requests to resources. If there's no
|
||||
// matching selector for operation, no billing status check will be performed.
|
||||
//
|
||||
message Billing {
|
||||
// Names of the metrics to report to billing. Each name must
|
||||
// be defined in [Service.metrics][google.api.Service.metrics] section.
|
||||
repeated string metrics = 1;
|
||||
|
||||
// A list of billing status rules for configuring billing status check.
|
||||
repeated BillingStatusRule rules = 5;
|
||||
}
|
||||
|
||||
// Defines the billing status requirements for operations.
|
||||
//
|
||||
// When used with
|
||||
// [Service Control API](https://cloud.google.com/service-control/), the
|
||||
// following statuses are supported:
|
||||
//
|
||||
// - **current**: the associated billing account is up to date and capable of
|
||||
// paying for resource usages.
|
||||
// - **delinquent**: the associated billing account has a correctable problem,
|
||||
// such as late payment.
|
||||
//
|
||||
// Mostly services should only allow `current` status when serving requests.
|
||||
// In addition, services can choose to allow both `current` and `delinquent`
|
||||
// statuses when serving read-only requests to resources. If the list of
|
||||
// allowed_statuses is empty, it means no billing requirement.
|
||||
//
|
||||
message BillingStatusRule {
|
||||
// Selects the operation names to which this rule applies.
|
||||
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
||||
string selector = 1;
|
||||
|
||||
// Allowed billing statuses. The billing status check passes if the actual
|
||||
// billing status matches any of the provided values here.
|
||||
repeated string allowed_statuses = 2;
|
||||
}
|
139
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/consumer.pb.go
generated
vendored
Normal file
139
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/consumer.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,139 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/serviceconfig/consumer.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
|
||||
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
|
||||
|
||||
// Supported data type of the property values
|
||||
type Property_PropertyType int32
|
||||
|
||||
const (
|
||||
// The type is unspecified, and will result in an error.
|
||||
Property_UNSPECIFIED Property_PropertyType = 0
|
||||
// The type is `int64`.
|
||||
Property_INT64 Property_PropertyType = 1
|
||||
// The type is `bool`.
|
||||
Property_BOOL Property_PropertyType = 2
|
||||
// The type is `string`.
|
||||
Property_STRING Property_PropertyType = 3
|
||||
// The type is 'double'.
|
||||
Property_DOUBLE Property_PropertyType = 4
|
||||
)
|
||||
|
||||
var Property_PropertyType_name = map[int32]string{
|
||||
0: "UNSPECIFIED",
|
||||
1: "INT64",
|
||||
2: "BOOL",
|
||||
3: "STRING",
|
||||
4: "DOUBLE",
|
||||
}
|
||||
var Property_PropertyType_value = map[string]int32{
|
||||
"UNSPECIFIED": 0,
|
||||
"INT64": 1,
|
||||
"BOOL": 2,
|
||||
"STRING": 3,
|
||||
"DOUBLE": 4,
|
||||
}
|
||||
|
||||
func (x Property_PropertyType) String() string {
|
||||
return proto.EnumName(Property_PropertyType_name, int32(x))
|
||||
}
|
||||
func (Property_PropertyType) EnumDescriptor() ([]byte, []int) { return fileDescriptor4, []int{1, 0} }
|
||||
|
||||
// A descriptor for defining project properties for a service. One service may
|
||||
// have many consumer projects, and the service may want to behave differently
|
||||
// depending on some properties on the project. For example, a project may be
|
||||
// associated with a school, or a business, or a government agency, a business
|
||||
// type property on the project may affect how a service responds to the client.
|
||||
// This descriptor defines which properties are allowed to be set on a project.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// project_properties:
|
||||
// properties:
|
||||
// - name: NO_WATERMARK
|
||||
// type: BOOL
|
||||
// description: Allows usage of the API without watermarks.
|
||||
// - name: EXTENDED_TILE_CACHE_PERIOD
|
||||
// type: INT64
|
||||
type ProjectProperties struct {
|
||||
// List of per consumer project-specific properties.
|
||||
Properties []*Property `protobuf:"bytes,1,rep,name=properties" json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ProjectProperties) Reset() { *m = ProjectProperties{} }
|
||||
func (m *ProjectProperties) String() string { return proto.CompactTextString(m) }
|
||||
func (*ProjectProperties) ProtoMessage() {}
|
||||
func (*ProjectProperties) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{0} }
|
||||
|
||||
func (m *ProjectProperties) GetProperties() []*Property {
|
||||
if m != nil {
|
||||
return m.Properties
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Defines project properties.
|
||||
//
|
||||
// API services can define properties that can be assigned to consumer projects
|
||||
// so that backends can perform response customization without having to make
|
||||
// additional calls or maintain additional storage. For example, Maps API
|
||||
// defines properties that controls map tile cache period, or whether to embed a
|
||||
// watermark in a result.
|
||||
//
|
||||
// These values can be set via API producer console. Only API providers can
|
||||
// define and set these properties.
|
||||
type Property struct {
|
||||
// The name of the property (a.k.a key).
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// The type of this property.
|
||||
Type Property_PropertyType `protobuf:"varint,2,opt,name=type,enum=google.api.Property_PropertyType" json:"type,omitempty"`
|
||||
// The description of the property
|
||||
Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Property) Reset() { *m = Property{} }
|
||||
func (m *Property) String() string { return proto.CompactTextString(m) }
|
||||
func (*Property) ProtoMessage() {}
|
||||
func (*Property) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{1} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*ProjectProperties)(nil), "google.api.ProjectProperties")
|
||||
proto.RegisterType((*Property)(nil), "google.api.Property")
|
||||
proto.RegisterEnum("google.api.Property_PropertyType", Property_PropertyType_name, Property_PropertyType_value)
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/serviceconfig/consumer.proto", fileDescriptor4)
|
||||
}
|
||||
|
||||
var fileDescriptor4 = []byte{
|
||||
// 287 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x90, 0xc1, 0x4e, 0xb3, 0x40,
|
||||
0x14, 0x85, 0x7f, 0x0a, 0x7f, 0xd3, 0x5e, 0xb4, 0xe2, 0xc4, 0x05, 0xcb, 0x96, 0x55, 0x57, 0x90,
|
||||
0xd4, 0xea, 0x03, 0xd0, 0x52, 0x43, 0x42, 0x80, 0x50, 0xfa, 0x00, 0x88, 0xd7, 0xc9, 0x98, 0xc2,
|
||||
0x4c, 0x06, 0x34, 0xe9, 0x03, 0xfa, 0x5e, 0x4e, 0x11, 0x2b, 0x0b, 0x37, 0xdc, 0xc3, 0xbd, 0xdf,
|
||||
0x39, 0x99, 0x1c, 0xd8, 0x51, 0xce, 0xe9, 0x11, 0x5d, 0xca, 0x8f, 0x45, 0x4d, 0x5d, 0x2e, 0xa9,
|
||||
0x47, 0xb1, 0x16, 0x92, 0xb7, 0xdc, 0xfb, 0x3e, 0x15, 0x82, 0x35, 0x9e, 0xfa, 0x78, 0x0d, 0xca,
|
||||
0x0f, 0x56, 0x62, 0xc9, 0xeb, 0x57, 0x46, 0x3d, 0x35, 0x9a, 0xf7, 0x0a, 0xa5, 0xdb, 0xb1, 0x04,
|
||||
0xfa, 0x1c, 0x05, 0x3a, 0x21, 0xdc, 0xa6, 0x92, 0xbf, 0x61, 0xd9, 0xaa, 0x21, 0x50, 0xb6, 0x0c,
|
||||
0x1b, 0xb2, 0x06, 0x10, 0x97, 0x3f, 0x5b, 0x9b, 0xeb, 0x4b, 0x73, 0x75, 0xe7, 0xfe, 0xba, 0xdc,
|
||||
0x9e, 0x3d, 0x65, 0x03, 0xce, 0xf9, 0xd4, 0x60, 0xf2, 0x73, 0x20, 0x04, 0x8c, 0xba, 0xa8, 0x50,
|
||||
0x99, 0xb5, 0xe5, 0x34, 0xeb, 0x34, 0x79, 0x00, 0xa3, 0x3d, 0x09, 0xb4, 0x47, 0x6a, 0x37, 0x5b,
|
||||
0x2d, 0xfe, 0x0a, 0xbc, 0x88, 0x5c, 0x81, 0x59, 0x87, 0x93, 0x39, 0x98, 0x2f, 0xd8, 0x94, 0x92,
|
||||
0x89, 0x96, 0xf1, 0xda, 0xd6, 0xbb, 0xc4, 0xe1, 0xca, 0x89, 0xe0, 0x6a, 0xe8, 0x23, 0x37, 0x60,
|
||||
0x1e, 0xe2, 0x7d, 0x1a, 0x6c, 0xc2, 0x5d, 0x18, 0x6c, 0xad, 0x7f, 0x64, 0x0a, 0xff, 0xc3, 0x38,
|
||||
0x7f, 0x5c, 0x5b, 0x1a, 0x99, 0x80, 0xe1, 0x27, 0x49, 0x64, 0x8d, 0x08, 0xc0, 0x78, 0x9f, 0x67,
|
||||
0x61, 0xfc, 0x64, 0xe9, 0x67, 0xbd, 0x4d, 0x0e, 0x7e, 0x14, 0x58, 0x86, 0xbf, 0x80, 0x59, 0xc9,
|
||||
0xab, 0xc1, 0xeb, 0xfc, 0xeb, 0x4d, 0x5f, 0x60, 0x7a, 0xee, 0x2f, 0xd5, 0x9e, 0xc7, 0x5d, 0x91,
|
||||
0xf7, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x61, 0xba, 0x74, 0x16, 0x92, 0x01, 0x00, 0x00,
|
||||
}
|
82
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/consumer.proto
generated
vendored
Normal file
82
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/consumer.proto
generated
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "ConsumerProto";
|
||||
option java_package = "com.google.api";
|
||||
|
||||
|
||||
// A descriptor for defining project properties for a service. One service may
|
||||
// have many consumer projects, and the service may want to behave differently
|
||||
// depending on some properties on the project. For example, a project may be
|
||||
// associated with a school, or a business, or a government agency, a business
|
||||
// type property on the project may affect how a service responds to the client.
|
||||
// This descriptor defines which properties are allowed to be set on a project.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// project_properties:
|
||||
// properties:
|
||||
// - name: NO_WATERMARK
|
||||
// type: BOOL
|
||||
// description: Allows usage of the API without watermarks.
|
||||
// - name: EXTENDED_TILE_CACHE_PERIOD
|
||||
// type: INT64
|
||||
message ProjectProperties {
|
||||
// List of per consumer project-specific properties.
|
||||
repeated Property properties = 1;
|
||||
}
|
||||
|
||||
// Defines project properties.
|
||||
//
|
||||
// API services can define properties that can be assigned to consumer projects
|
||||
// so that backends can perform response customization without having to make
|
||||
// additional calls or maintain additional storage. For example, Maps API
|
||||
// defines properties that controls map tile cache period, or whether to embed a
|
||||
// watermark in a result.
|
||||
//
|
||||
// These values can be set via API producer console. Only API providers can
|
||||
// define and set these properties.
|
||||
message Property {
|
||||
// Supported data type of the property values
|
||||
enum PropertyType {
|
||||
// The type is unspecified, and will result in an error.
|
||||
UNSPECIFIED = 0;
|
||||
|
||||
// The type is `int64`.
|
||||
INT64 = 1;
|
||||
|
||||
// The type is `bool`.
|
||||
BOOL = 2;
|
||||
|
||||
// The type is `string`.
|
||||
STRING = 3;
|
||||
|
||||
// The type is 'double'.
|
||||
DOUBLE = 4;
|
||||
}
|
||||
|
||||
// The name of the property (a.k.a key).
|
||||
string name = 1;
|
||||
|
||||
// The type of this property.
|
||||
PropertyType type = 2;
|
||||
|
||||
// The description of the property
|
||||
string description = 3;
|
||||
}
|
95
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/context.pb.go
generated
vendored
Normal file
95
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/context.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,95 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/serviceconfig/context.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
|
||||
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
|
||||
|
||||
// `Context` defines which contexts an API requests.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// context:
|
||||
// rules:
|
||||
// - selector: "*"
|
||||
// requested:
|
||||
// - google.rpc.context.ProjectContext
|
||||
// - google.rpc.context.OriginContext
|
||||
//
|
||||
// The above specifies that all methods in the API request
|
||||
// `google.rpc.context.ProjectContext` and
|
||||
// `google.rpc.context.OriginContext`.
|
||||
//
|
||||
// Available context types are defined in package
|
||||
// `google.rpc.context`.
|
||||
type Context struct {
|
||||
// A list of RPC context rules that apply to individual API methods.
|
||||
//
|
||||
// **NOTE:** All service configuration rules follow "last one wins" order.
|
||||
Rules []*ContextRule `protobuf:"bytes,1,rep,name=rules" json:"rules,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Context) Reset() { *m = Context{} }
|
||||
func (m *Context) String() string { return proto.CompactTextString(m) }
|
||||
func (*Context) ProtoMessage() {}
|
||||
func (*Context) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{0} }
|
||||
|
||||
func (m *Context) GetRules() []*ContextRule {
|
||||
if m != nil {
|
||||
return m.Rules
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A context rule provides information about the context for an individual API
|
||||
// element.
|
||||
type ContextRule struct {
|
||||
// Selects the methods to which this rule applies.
|
||||
//
|
||||
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
||||
Selector string `protobuf:"bytes,1,opt,name=selector" json:"selector,omitempty"`
|
||||
// A list of full type names of requested contexts.
|
||||
Requested []string `protobuf:"bytes,2,rep,name=requested" json:"requested,omitempty"`
|
||||
// A list of full type names of provided contexts.
|
||||
Provided []string `protobuf:"bytes,3,rep,name=provided" json:"provided,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ContextRule) Reset() { *m = ContextRule{} }
|
||||
func (m *ContextRule) String() string { return proto.CompactTextString(m) }
|
||||
func (*ContextRule) ProtoMessage() {}
|
||||
func (*ContextRule) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{1} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Context)(nil), "google.api.Context")
|
||||
proto.RegisterType((*ContextRule)(nil), "google.api.ContextRule")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/serviceconfig/context.proto", fileDescriptor5)
|
||||
}
|
||||
|
||||
var fileDescriptor5 = []byte{
|
||||
// 219 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x72, 0x4d, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0x4b, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0xcb, 0x2f, 0x4a, 0xd7, 0x4f, 0x4f,
|
||||
0xcd, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x87, 0x48, 0x25, 0x16, 0x64, 0x16, 0xeb, 0x03, 0x09,
|
||||
0xfd, 0xe2, 0xd4, 0xa2, 0xb2, 0xcc, 0xe4, 0xd4, 0xe4, 0xfc, 0xbc, 0xb4, 0xcc, 0x74, 0x7d, 0x20,
|
||||
0x55, 0x92, 0x5a, 0x51, 0xa2, 0x07, 0x56, 0x2a, 0xc4, 0x05, 0x35, 0x06, 0xa8, 0x4e, 0xc9, 0x82,
|
||||
0x8b, 0xdd, 0x19, 0x22, 0x29, 0xa4, 0xcb, 0xc5, 0x5a, 0x54, 0x9a, 0x93, 0x5a, 0x2c, 0xc1, 0xa8,
|
||||
0xc0, 0xac, 0xc1, 0x6d, 0x24, 0xae, 0x87, 0x50, 0xa6, 0x07, 0x55, 0x13, 0x04, 0x94, 0x0f, 0x82,
|
||||
0xa8, 0x52, 0x4a, 0xe6, 0xe2, 0x46, 0x12, 0x15, 0x92, 0xe2, 0xe2, 0x28, 0x4e, 0xcd, 0x49, 0x4d,
|
||||
0x2e, 0xc9, 0x2f, 0x02, 0x1a, 0xc0, 0xa8, 0xc1, 0x19, 0x04, 0xe7, 0x0b, 0xc9, 0x70, 0x71, 0x16,
|
||||
0xa5, 0x16, 0x96, 0xa6, 0x16, 0x97, 0xa4, 0xa6, 0x48, 0x30, 0x01, 0x4d, 0xe7, 0x0c, 0x42, 0x08,
|
||||
0x80, 0x74, 0x02, 0xdd, 0x55, 0x96, 0x99, 0x02, 0x94, 0x64, 0x06, 0x4b, 0xc2, 0xf9, 0x4e, 0xea,
|
||||
0x5c, 0x7c, 0xc9, 0xf9, 0xb9, 0x48, 0x2e, 0x71, 0xe2, 0x81, 0x5a, 0x1a, 0x00, 0xf2, 0x4a, 0x00,
|
||||
0xe3, 0x22, 0x26, 0x16, 0x77, 0xc7, 0x00, 0xcf, 0x24, 0x36, 0xb0, 0xd7, 0x8c, 0x01, 0x01, 0x00,
|
||||
0x00, 0xff, 0xff, 0xe7, 0x43, 0x17, 0x5f, 0x23, 0x01, 0x00, 0x00,
|
||||
}
|
62
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/context.proto
generated
vendored
Normal file
62
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/context.proto
generated
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "ContextProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
|
||||
// `Context` defines which contexts an API requests.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// context:
|
||||
// rules:
|
||||
// - selector: "*"
|
||||
// requested:
|
||||
// - google.rpc.context.ProjectContext
|
||||
// - google.rpc.context.OriginContext
|
||||
//
|
||||
// The above specifies that all methods in the API request
|
||||
// `google.rpc.context.ProjectContext` and
|
||||
// `google.rpc.context.OriginContext`.
|
||||
//
|
||||
// Available context types are defined in package
|
||||
// `google.rpc.context`.
|
||||
message Context {
|
||||
// A list of RPC context rules that apply to individual API methods.
|
||||
//
|
||||
// **NOTE:** All service configuration rules follow "last one wins" order.
|
||||
repeated ContextRule rules = 1;
|
||||
}
|
||||
|
||||
// A context rule provides information about the context for an individual API
|
||||
// element.
|
||||
message ContextRule {
|
||||
// Selects the methods to which this rule applies.
|
||||
//
|
||||
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
||||
string selector = 1;
|
||||
|
||||
// A list of full type names of requested contexts.
|
||||
repeated string requested = 2;
|
||||
|
||||
// A list of full type names of provided contexts.
|
||||
repeated string provided = 3;
|
||||
}
|
50
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/control.pb.go
generated
vendored
Normal file
50
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/control.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/serviceconfig/control.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
|
||||
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
|
||||
|
||||
// Selects and configures the service controller used by the service. The
|
||||
// service controller handles features like abuse, quota, billing, logging,
|
||||
// monitoring, etc.
|
||||
type Control struct {
|
||||
// The service control environment to use. If empty, no control plane
|
||||
// feature (like quota and billing) will be enabled.
|
||||
Environment string `protobuf:"bytes,1,opt,name=environment" json:"environment,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Control) Reset() { *m = Control{} }
|
||||
func (m *Control) String() string { return proto.CompactTextString(m) }
|
||||
func (*Control) ProtoMessage() {}
|
||||
func (*Control) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{0} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Control)(nil), "google.api.Control")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/serviceconfig/control.proto", fileDescriptor6)
|
||||
}
|
||||
|
||||
var fileDescriptor6 = []byte{
|
||||
// 154 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x72, 0x4d, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0x4b, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0xcb, 0x2f, 0x4a, 0xd7, 0x4f, 0x4f,
|
||||
0xcd, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x87, 0x48, 0x25, 0x16, 0x64, 0x16, 0xeb, 0x03, 0x09,
|
||||
0xfd, 0xe2, 0xd4, 0xa2, 0xb2, 0xcc, 0xe4, 0xd4, 0xe4, 0xfc, 0xbc, 0xb4, 0xcc, 0x74, 0x7d, 0x20,
|
||||
0x55, 0x52, 0x94, 0x9f, 0xa3, 0x07, 0x56, 0x2a, 0xc4, 0x05, 0x35, 0x06, 0xa8, 0x4e, 0x49, 0x9b,
|
||||
0x8b, 0xdd, 0x19, 0x22, 0x29, 0xa4, 0xc0, 0xc5, 0x9d, 0x9a, 0x57, 0x96, 0x59, 0x94, 0x9f, 0x97,
|
||||
0x9b, 0x9a, 0x57, 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x84, 0x2c, 0xe4, 0xa4, 0xce, 0xc5,
|
||||
0x97, 0x9c, 0x9f, 0xab, 0x87, 0xd0, 0xee, 0xc4, 0x03, 0xd5, 0x1c, 0x00, 0x32, 0x38, 0x80, 0x71,
|
||||
0x11, 0x13, 0x8b, 0xbb, 0x63, 0x80, 0x67, 0x12, 0x1b, 0xd8, 0x22, 0x63, 0x40, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0x77, 0x67, 0xbb, 0x6f, 0xb1, 0x00, 0x00, 0x00,
|
||||
}
|
32
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/control.proto
generated
vendored
Normal file
32
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/control.proto
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "ControlProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
|
||||
// Selects and configures the service controller used by the service. The
|
||||
// service controller handles features like abuse, quota, billing, logging,
|
||||
// monitoring, etc.
|
||||
message Control {
|
||||
// The service control environment to use. If empty, no control plane
|
||||
// feature (like quota and billing) will be enabled.
|
||||
string environment = 1;
|
||||
}
|
213
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/documentation.pb.go
generated
vendored
Normal file
213
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/documentation.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,213 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/serviceconfig/documentation.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
|
||||
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
|
||||
|
||||
// `Documentation` provides the information for describing a service.
|
||||
//
|
||||
// Example:
|
||||
// <pre><code>documentation:
|
||||
// summary: >
|
||||
// The Google Calendar API gives access
|
||||
// to most calendar features.
|
||||
// pages:
|
||||
// - name: Overview
|
||||
// content: (== include google/foo/overview.md ==)
|
||||
// - name: Tutorial
|
||||
// content: (== include google/foo/tutorial.md ==)
|
||||
// subpages;
|
||||
// - name: Java
|
||||
// content: (== include google/foo/tutorial_java.md ==)
|
||||
// rules:
|
||||
// - selector: google.calendar.Calendar.Get
|
||||
// description: >
|
||||
// ...
|
||||
// - selector: google.calendar.Calendar.Put
|
||||
// description: >
|
||||
// ...
|
||||
// </code></pre>
|
||||
// Documentation is provided in markdown syntax. In addition to
|
||||
// standard markdown features, definition lists, tables and fenced
|
||||
// code blocks are supported. Section headers can be provided and are
|
||||
// interpreted relative to the section nesting of the context where
|
||||
// a documentation fragment is embedded.
|
||||
//
|
||||
// Documentation from the IDL is merged with documentation defined
|
||||
// via the config at normalization time, where documentation provided
|
||||
// by config rules overrides IDL provided.
|
||||
//
|
||||
// A number of constructs specific to the API platform are supported
|
||||
// in documentation text.
|
||||
//
|
||||
// In order to reference a proto element, the following
|
||||
// notation can be used:
|
||||
// <pre><code>[fully.qualified.proto.name][]</code></pre>
|
||||
// To override the display text used for the link, this can be used:
|
||||
// <pre><code>[display text][fully.qualified.proto.name]</code></pre>
|
||||
// Text can be excluded from doc using the following notation:
|
||||
// <pre><code>(-- internal comment --)</code></pre>
|
||||
// Comments can be made conditional using a visibility label. The below
|
||||
// text will be only rendered if the `BETA` label is available:
|
||||
// <pre><code>(--BETA: comment for BETA users --)</code></pre>
|
||||
// A few directives are available in documentation. Note that
|
||||
// directives must appear on a single line to be properly
|
||||
// identified. The `include` directive includes a markdown file from
|
||||
// an external source:
|
||||
// <pre><code>(== include path/to/file ==)</code></pre>
|
||||
// The `resource_for` directive marks a message to be the resource of
|
||||
// a collection in REST view. If it is not specified, tools attempt
|
||||
// to infer the resource from the operations in a collection:
|
||||
// <pre><code>(== resource_for v1.shelves.books ==)</code></pre>
|
||||
// The directive `suppress_warning` does not directly affect documentation
|
||||
// and is documented together with service config validation.
|
||||
type Documentation struct {
|
||||
// A short summary of what the service does. Can only be provided by
|
||||
// plain text.
|
||||
Summary string `protobuf:"bytes,1,opt,name=summary" json:"summary,omitempty"`
|
||||
// The top level pages for the documentation set.
|
||||
Pages []*Page `protobuf:"bytes,5,rep,name=pages" json:"pages,omitempty"`
|
||||
// A list of documentation rules that apply to individual API elements.
|
||||
//
|
||||
// **NOTE:** All service configuration rules follow "last one wins" order.
|
||||
Rules []*DocumentationRule `protobuf:"bytes,3,rep,name=rules" json:"rules,omitempty"`
|
||||
// The URL to the root of documentation.
|
||||
DocumentationRootUrl string `protobuf:"bytes,4,opt,name=documentation_root_url,json=documentationRootUrl" json:"documentation_root_url,omitempty"`
|
||||
// Declares a single overview page. For example:
|
||||
// <pre><code>documentation:
|
||||
// summary: ...
|
||||
// overview: (== include overview.md ==)
|
||||
// </code></pre>
|
||||
// This is a shortcut for the following declaration (using pages style):
|
||||
// <pre><code>documentation:
|
||||
// summary: ...
|
||||
// pages:
|
||||
// - name: Overview
|
||||
// content: (== include overview.md ==)
|
||||
// </code></pre>
|
||||
// Note: you cannot specify both `overview` field and `pages` field.
|
||||
Overview string `protobuf:"bytes,2,opt,name=overview" json:"overview,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Documentation) Reset() { *m = Documentation{} }
|
||||
func (m *Documentation) String() string { return proto.CompactTextString(m) }
|
||||
func (*Documentation) ProtoMessage() {}
|
||||
func (*Documentation) Descriptor() ([]byte, []int) { return fileDescriptor7, []int{0} }
|
||||
|
||||
func (m *Documentation) GetPages() []*Page {
|
||||
if m != nil {
|
||||
return m.Pages
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Documentation) GetRules() []*DocumentationRule {
|
||||
if m != nil {
|
||||
return m.Rules
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A documentation rule provides information about individual API elements.
|
||||
type DocumentationRule struct {
|
||||
// The selector is a comma-separated list of patterns. Each pattern is a
|
||||
// qualified name of the element which may end in "*", indicating a wildcard.
|
||||
// Wildcards are only allowed at the end and for a whole component of the
|
||||
// qualified name, i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". To
|
||||
// specify a default for all applicable elements, the whole pattern "*"
|
||||
// is used.
|
||||
Selector string `protobuf:"bytes,1,opt,name=selector" json:"selector,omitempty"`
|
||||
// Description of the selected API(s).
|
||||
Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"`
|
||||
// Deprecation description of the selected element(s). It can be provided if an
|
||||
// element is marked as `deprecated`.
|
||||
DeprecationDescription string `protobuf:"bytes,3,opt,name=deprecation_description,json=deprecationDescription" json:"deprecation_description,omitempty"`
|
||||
}
|
||||
|
||||
func (m *DocumentationRule) Reset() { *m = DocumentationRule{} }
|
||||
func (m *DocumentationRule) String() string { return proto.CompactTextString(m) }
|
||||
func (*DocumentationRule) ProtoMessage() {}
|
||||
func (*DocumentationRule) Descriptor() ([]byte, []int) { return fileDescriptor7, []int{1} }
|
||||
|
||||
// Represents a documentation page. A page can contain subpages to represent
|
||||
// nested documentation set structure.
|
||||
type Page struct {
|
||||
// The name of the page. It will be used as an identity of the page to
|
||||
// generate URI of the page, text of the link to this page in navigation,
|
||||
// etc. The full page name (start from the root page name to this page
|
||||
// concatenated with `.`) can be used as reference to the page in your
|
||||
// documentation. For example:
|
||||
// <pre><code>pages:
|
||||
// - name: Tutorial
|
||||
// content: (== include tutorial.md ==)
|
||||
// subpages:
|
||||
// - name: Java
|
||||
// content: (== include tutorial_java.md ==)
|
||||
// </code></pre>
|
||||
// You can reference `Java` page using Markdown reference link syntax:
|
||||
// `[Java][Tutorial.Java]`.
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// The Markdown content of the page. You can use <code>(== include {path} ==)</code>
|
||||
// to include content from a Markdown file.
|
||||
Content string `protobuf:"bytes,2,opt,name=content" json:"content,omitempty"`
|
||||
// Subpages of this page. The order of subpages specified here will be
|
||||
// honored in the generated docset.
|
||||
Subpages []*Page `protobuf:"bytes,3,rep,name=subpages" json:"subpages,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Page) Reset() { *m = Page{} }
|
||||
func (m *Page) String() string { return proto.CompactTextString(m) }
|
||||
func (*Page) ProtoMessage() {}
|
||||
func (*Page) Descriptor() ([]byte, []int) { return fileDescriptor7, []int{2} }
|
||||
|
||||
func (m *Page) GetSubpages() []*Page {
|
||||
if m != nil {
|
||||
return m.Subpages
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Documentation)(nil), "google.api.Documentation")
|
||||
proto.RegisterType((*DocumentationRule)(nil), "google.api.DocumentationRule")
|
||||
proto.RegisterType((*Page)(nil), "google.api.Page")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/serviceconfig/documentation.proto", fileDescriptor7)
|
||||
}
|
||||
|
||||
var fileDescriptor7 = []byte{
|
||||
// 342 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x92, 0xcf, 0x4a, 0xc3, 0x40,
|
||||
0x10, 0xc6, 0x49, 0x93, 0xfa, 0x67, 0x8a, 0xa2, 0x8b, 0xd4, 0x20, 0x08, 0xa5, 0x07, 0xe9, 0x41,
|
||||
0x13, 0xb0, 0x82, 0x67, 0x4b, 0x41, 0xc4, 0x4b, 0x08, 0x78, 0x2e, 0xe9, 0x76, 0x5c, 0x02, 0x49,
|
||||
0x26, 0x6c, 0x92, 0x8a, 0xaf, 0xe0, 0x63, 0xf8, 0x54, 0x3e, 0x8e, 0x9b, 0x4d, 0x9a, 0x6e, 0x10,
|
||||
0x2f, 0x21, 0x93, 0xef, 0xb7, 0x33, 0xdf, 0x7c, 0x1b, 0x78, 0x15, 0x44, 0x22, 0x41, 0x4f, 0x50,
|
||||
0x12, 0x65, 0xc2, 0x23, 0x29, 0x7c, 0x81, 0x59, 0x2e, 0xa9, 0x24, 0xbf, 0x91, 0xa2, 0x3c, 0x2e,
|
||||
0x7c, 0xf5, 0xf0, 0x0b, 0x94, 0xdb, 0x98, 0x23, 0xa7, 0xec, 0x3d, 0x16, 0xfe, 0x86, 0x78, 0x95,
|
||||
0x62, 0x56, 0x46, 0x65, 0x4c, 0x99, 0xa7, 0x0f, 0x30, 0x68, 0x9b, 0x29, 0x7a, 0xfa, 0x63, 0xc1,
|
||||
0xc9, 0xd2, 0x64, 0x98, 0x0b, 0x87, 0x45, 0x95, 0xa6, 0x91, 0xfc, 0x74, 0xad, 0x89, 0x35, 0x3b,
|
||||
0x0e, 0x77, 0x25, 0xbb, 0x81, 0x61, 0x1e, 0x09, 0x2c, 0xdc, 0xe1, 0xc4, 0x9e, 0x8d, 0xee, 0xcf,
|
||||
0xbc, 0x7d, 0x1f, 0x2f, 0x50, 0x42, 0xd8, 0xc8, 0x6c, 0x0e, 0x43, 0x59, 0x25, 0x8a, 0xb3, 0x35,
|
||||
0x77, 0x6d, 0x72, 0xbd, 0x59, 0xa1, 0xa2, 0xc2, 0x86, 0x65, 0x0f, 0x30, 0xee, 0x79, 0x5d, 0x49,
|
||||
0xa2, 0x72, 0x55, 0xc9, 0xc4, 0x75, 0xb4, 0x8b, 0x8b, 0x9e, 0x1a, 0x2a, 0xf1, 0x4d, 0x26, 0xec,
|
||||
0x0a, 0x8e, 0x68, 0x5b, 0x2f, 0x8c, 0x1f, 0xee, 0x40, 0x73, 0x5d, 0x3d, 0xfd, 0xb2, 0xe0, 0xfc,
|
||||
0xcf, 0xb8, 0xfa, 0x44, 0x81, 0x09, 0xf2, 0x92, 0x64, 0xbb, 0x5f, 0x57, 0xb3, 0x09, 0x8c, 0x36,
|
||||
0x58, 0x70, 0x19, 0xe7, 0x35, 0xde, 0x36, 0x34, 0x3f, 0xb1, 0x47, 0xb8, 0xdc, 0x60, 0x2e, 0x91,
|
||||
0x37, 0x1e, 0x4d, 0xda, 0xd6, 0xf4, 0xd8, 0x90, 0x97, 0x7b, 0x75, 0xba, 0x06, 0xa7, 0x8e, 0x88,
|
||||
0x31, 0x70, 0xb2, 0x28, 0xc5, 0x76, 0xb4, 0x7e, 0xaf, 0x13, 0x57, 0xb7, 0x55, 0x2a, 0x9b, 0xed,
|
||||
0xc8, 0x5d, 0xc9, 0x6e, 0x95, 0xd9, 0x6a, 0xdd, 0x84, 0x6e, 0xff, 0x13, 0x7a, 0x47, 0x2c, 0xee,
|
||||
0xe0, 0x94, 0x53, 0x6a, 0x00, 0x0b, 0xd6, 0xdb, 0x3f, 0xa8, 0x6f, 0x3f, 0xb0, 0xbe, 0x07, 0xce,
|
||||
0xf3, 0x53, 0xf0, 0xb2, 0x3e, 0xd0, 0x7f, 0xc3, 0xfc, 0x37, 0x00, 0x00, 0xff, 0xff, 0x62, 0xd9,
|
||||
0x85, 0x51, 0x5c, 0x02, 0x00, 0x00,
|
||||
}
|
158
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/documentation.proto
generated
vendored
Normal file
158
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/documentation.proto
generated
vendored
Normal file
|
@ -0,0 +1,158 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "DocumentationProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
|
||||
// `Documentation` provides the information for describing a service.
|
||||
//
|
||||
// Example:
|
||||
// <pre><code>documentation:
|
||||
// summary: >
|
||||
// The Google Calendar API gives access
|
||||
// to most calendar features.
|
||||
// pages:
|
||||
// - name: Overview
|
||||
// content: (== include google/foo/overview.md ==)
|
||||
// - name: Tutorial
|
||||
// content: (== include google/foo/tutorial.md ==)
|
||||
// subpages;
|
||||
// - name: Java
|
||||
// content: (== include google/foo/tutorial_java.md ==)
|
||||
// rules:
|
||||
// - selector: google.calendar.Calendar.Get
|
||||
// description: >
|
||||
// ...
|
||||
// - selector: google.calendar.Calendar.Put
|
||||
// description: >
|
||||
// ...
|
||||
// </code></pre>
|
||||
// Documentation is provided in markdown syntax. In addition to
|
||||
// standard markdown features, definition lists, tables and fenced
|
||||
// code blocks are supported. Section headers can be provided and are
|
||||
// interpreted relative to the section nesting of the context where
|
||||
// a documentation fragment is embedded.
|
||||
//
|
||||
// Documentation from the IDL is merged with documentation defined
|
||||
// via the config at normalization time, where documentation provided
|
||||
// by config rules overrides IDL provided.
|
||||
//
|
||||
// A number of constructs specific to the API platform are supported
|
||||
// in documentation text.
|
||||
//
|
||||
// In order to reference a proto element, the following
|
||||
// notation can be used:
|
||||
// <pre><code>[fully.qualified.proto.name][]</code></pre>
|
||||
// To override the display text used for the link, this can be used:
|
||||
// <pre><code>[display text][fully.qualified.proto.name]</code></pre>
|
||||
// Text can be excluded from doc using the following notation:
|
||||
// <pre><code>(-- internal comment --)</code></pre>
|
||||
// Comments can be made conditional using a visibility label. The below
|
||||
// text will be only rendered if the `BETA` label is available:
|
||||
// <pre><code>(--BETA: comment for BETA users --)</code></pre>
|
||||
// A few directives are available in documentation. Note that
|
||||
// directives must appear on a single line to be properly
|
||||
// identified. The `include` directive includes a markdown file from
|
||||
// an external source:
|
||||
// <pre><code>(== include path/to/file ==)</code></pre>
|
||||
// The `resource_for` directive marks a message to be the resource of
|
||||
// a collection in REST view. If it is not specified, tools attempt
|
||||
// to infer the resource from the operations in a collection:
|
||||
// <pre><code>(== resource_for v1.shelves.books ==)</code></pre>
|
||||
// The directive `suppress_warning` does not directly affect documentation
|
||||
// and is documented together with service config validation.
|
||||
message Documentation {
|
||||
// A short summary of what the service does. Can only be provided by
|
||||
// plain text.
|
||||
string summary = 1;
|
||||
|
||||
// The top level pages for the documentation set.
|
||||
repeated Page pages = 5;
|
||||
|
||||
// A list of documentation rules that apply to individual API elements.
|
||||
//
|
||||
// **NOTE:** All service configuration rules follow "last one wins" order.
|
||||
repeated DocumentationRule rules = 3;
|
||||
|
||||
// The URL to the root of documentation.
|
||||
string documentation_root_url = 4;
|
||||
|
||||
// Declares a single overview page. For example:
|
||||
// <pre><code>documentation:
|
||||
// summary: ...
|
||||
// overview: (== include overview.md ==)
|
||||
// </code></pre>
|
||||
// This is a shortcut for the following declaration (using pages style):
|
||||
// <pre><code>documentation:
|
||||
// summary: ...
|
||||
// pages:
|
||||
// - name: Overview
|
||||
// content: (== include overview.md ==)
|
||||
// </code></pre>
|
||||
// Note: you cannot specify both `overview` field and `pages` field.
|
||||
string overview = 2;
|
||||
}
|
||||
|
||||
// A documentation rule provides information about individual API elements.
|
||||
message DocumentationRule {
|
||||
// The selector is a comma-separated list of patterns. Each pattern is a
|
||||
// qualified name of the element which may end in "*", indicating a wildcard.
|
||||
// Wildcards are only allowed at the end and for a whole component of the
|
||||
// qualified name, i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". To
|
||||
// specify a default for all applicable elements, the whole pattern "*"
|
||||
// is used.
|
||||
string selector = 1;
|
||||
|
||||
// Description of the selected API(s).
|
||||
string description = 2;
|
||||
|
||||
// Deprecation description of the selected element(s). It can be provided if an
|
||||
// element is marked as `deprecated`.
|
||||
string deprecation_description = 3;
|
||||
}
|
||||
|
||||
// Represents a documentation page. A page can contain subpages to represent
|
||||
// nested documentation set structure.
|
||||
message Page {
|
||||
// The name of the page. It will be used as an identity of the page to
|
||||
// generate URI of the page, text of the link to this page in navigation,
|
||||
// etc. The full page name (start from the root page name to this page
|
||||
// concatenated with `.`) can be used as reference to the page in your
|
||||
// documentation. For example:
|
||||
// <pre><code>pages:
|
||||
// - name: Tutorial
|
||||
// content: (== include tutorial.md ==)
|
||||
// subpages:
|
||||
// - name: Java
|
||||
// content: (== include tutorial_java.md ==)
|
||||
// </code></pre>
|
||||
// You can reference `Java` page using Markdown reference link syntax:
|
||||
// `[Java][Tutorial.Java]`.
|
||||
string name = 1;
|
||||
|
||||
// The Markdown content of the page. You can use <code>(== include {path} ==)</code>
|
||||
// to include content from a Markdown file.
|
||||
string content = 2;
|
||||
|
||||
// Subpages of this page. The order of subpages specified here will be
|
||||
// honored in the generated docset.
|
||||
repeated Page subpages = 3;
|
||||
}
|
106
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/endpoint.pb.go
generated
vendored
Normal file
106
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/endpoint.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,106 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/serviceconfig/endpoint.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
|
||||
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
|
||||
|
||||
// `Endpoint` describes a network endpoint that serves a set of APIs.
|
||||
// A service may expose any number of endpoints, and all endpoints share the
|
||||
// same service configuration, such as quota configuration and monitoring
|
||||
// configuration.
|
||||
//
|
||||
// Example service configuration:
|
||||
//
|
||||
// name: library-example.googleapis.com
|
||||
// endpoints:
|
||||
// # Below entry makes 'google.example.library.v1.Library'
|
||||
// # API be served from endpoint address library-example.googleapis.com.
|
||||
// # It also allows HTTP OPTIONS calls to be passed to the backend, for
|
||||
// # it to decide whether the subsequent cross-origin request is
|
||||
// # allowed to proceed.
|
||||
// - name: library-example.googleapis.com
|
||||
// apis: google.example.library.v1.Library
|
||||
// allow_cors: true
|
||||
// # Below entry makes 'google.example.library.v1.Library'
|
||||
// # API be served from endpoint address
|
||||
// # google.example.library-example.v1.LibraryManager.
|
||||
// - name: library-manager.googleapis.com
|
||||
// apis: google.example.library.v1.LibraryManager
|
||||
// # BNS address for a borg job. Can specify a task by appending
|
||||
// # "/taskId" (e.g. "/0") to the job spec.
|
||||
//
|
||||
// Example OpenAPI extension for endpoint with allow_cors set to true:
|
||||
//
|
||||
// {
|
||||
// "swagger": "2.0",
|
||||
// "info": {
|
||||
// "description": "A simple..."
|
||||
// },
|
||||
// "host": "MY_PROJECT_ID.appspot.com",
|
||||
// "x-google-endpoints": [{
|
||||
// "name": "MY_PROJECT_ID.appspot.com",
|
||||
// "allow_cors": "true"
|
||||
// }]
|
||||
// }
|
||||
type Endpoint struct {
|
||||
// The canonical name of this endpoint.
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// DEPRECATED: This field is no longer supported. Instead of using aliases,
|
||||
// please specify multiple [google.api.Endpoint][google.api.Endpoint] for each of the intented
|
||||
// alias.
|
||||
//
|
||||
// Additional names that this endpoint will be hosted on.
|
||||
Aliases []string `protobuf:"bytes,2,rep,name=aliases" json:"aliases,omitempty"`
|
||||
// The list of APIs served by this endpoint.
|
||||
Apis []string `protobuf:"bytes,3,rep,name=apis" json:"apis,omitempty"`
|
||||
// The list of features enabled on this endpoint.
|
||||
Features []string `protobuf:"bytes,4,rep,name=features" json:"features,omitempty"`
|
||||
// Allowing
|
||||
// [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka
|
||||
// cross-domain traffic, would allow the backends served from this endpoint to
|
||||
// receive and respond to HTTP OPTIONS requests. The response will be used by
|
||||
// the browser to determine whether the subsequent cross-origin request is
|
||||
// allowed to proceed.
|
||||
AllowCors bool `protobuf:"varint,5,opt,name=allow_cors,json=allowCors" json:"allow_cors,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Endpoint) Reset() { *m = Endpoint{} }
|
||||
func (m *Endpoint) String() string { return proto.CompactTextString(m) }
|
||||
func (*Endpoint) ProtoMessage() {}
|
||||
func (*Endpoint) Descriptor() ([]byte, []int) { return fileDescriptor8, []int{0} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Endpoint)(nil), "google.api.Endpoint")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/serviceconfig/endpoint.proto", fileDescriptor8)
|
||||
}
|
||||
|
||||
var fileDescriptor8 = []byte{
|
||||
// 234 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x8f, 0xc1, 0x4a, 0x03, 0x31,
|
||||
0x10, 0x86, 0xd9, 0x76, 0xd5, 0xed, 0x80, 0x1e, 0x72, 0x0a, 0x05, 0xa1, 0x78, 0xea, 0x69, 0x73,
|
||||
0xf0, 0x09, 0xac, 0xa8, 0xf4, 0xb6, 0xf4, 0x05, 0x64, 0x5c, 0xa7, 0x21, 0x90, 0xce, 0x2c, 0x49,
|
||||
0xd4, 0x47, 0xf0, 0x3d, 0x7c, 0x52, 0xb3, 0x69, 0x57, 0xef, 0xbd, 0x84, 0x99, 0x2f, 0x3f, 0xff,
|
||||
0xff, 0x0f, 0x3c, 0x5b, 0x11, 0xeb, 0xa9, 0xb5, 0xe2, 0x91, 0x6d, 0x2b, 0xc1, 0x1a, 0x4b, 0x3c,
|
||||
0x04, 0x49, 0x62, 0x8e, 0x5f, 0x38, 0xb8, 0x68, 0xf2, 0x63, 0x22, 0x85, 0x4f, 0xd7, 0x53, 0x2f,
|
||||
0xbc, 0x77, 0xd6, 0x10, 0xbf, 0x0f, 0xe2, 0x38, 0xb5, 0x45, 0xab, 0xe0, 0xe4, 0x93, 0x85, 0xcb,
|
||||
0xed, 0xb9, 0x9e, 0xc8, 0x2c, 0x09, 0x93, 0x13, 0x8e, 0x47, 0xdb, 0xbb, 0xef, 0x0a, 0x9a, 0xa7,
|
||||
0x53, 0x92, 0x52, 0x50, 0x33, 0x1e, 0x48, 0x57, 0xab, 0x6a, 0xbd, 0xd8, 0x95, 0x59, 0x69, 0xb8,
|
||||
0x42, 0xef, 0x30, 0x52, 0xd4, 0xb3, 0xd5, 0x3c, 0xe3, 0x69, 0x1d, 0xd5, 0x63, 0x8c, 0x9e, 0x17,
|
||||
0x5c, 0x66, 0xb5, 0x84, 0x66, 0x4f, 0x98, 0x3e, 0x42, 0x96, 0xd7, 0x85, 0xff, 0xed, 0xea, 0x16,
|
||||
0x00, 0xbd, 0x97, 0xaf, 0xd7, 0x5e, 0x42, 0xd4, 0x17, 0x39, 0xa3, 0xd9, 0x2d, 0x0a, 0x79, 0xcc,
|
||||
0x60, 0xb3, 0x86, 0x9b, 0x5e, 0x0e, 0xed, 0xff, 0x99, 0x9b, 0xeb, 0xa9, 0x58, 0x37, 0x56, 0xed,
|
||||
0xaa, 0x9f, 0x59, 0xfd, 0xf2, 0xd0, 0x6d, 0xdf, 0x2e, 0x4b, 0xf5, 0xfb, 0xdf, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0x2f, 0xf3, 0xbc, 0x78, 0x5b, 0x01, 0x00, 0x00,
|
||||
}
|
89
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/endpoint.proto
generated
vendored
Normal file
89
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/endpoint.proto
generated
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto"; // from google/api/annotations.proto
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "EndpointProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
|
||||
// `Endpoint` describes a network endpoint that serves a set of APIs.
|
||||
// A service may expose any number of endpoints, and all endpoints share the
|
||||
// same service configuration, such as quota configuration and monitoring
|
||||
// configuration.
|
||||
//
|
||||
// Example service configuration:
|
||||
//
|
||||
// name: library-example.googleapis.com
|
||||
// endpoints:
|
||||
// # Below entry makes 'google.example.library.v1.Library'
|
||||
// # API be served from endpoint address library-example.googleapis.com.
|
||||
// # It also allows HTTP OPTIONS calls to be passed to the backend, for
|
||||
// # it to decide whether the subsequent cross-origin request is
|
||||
// # allowed to proceed.
|
||||
// - name: library-example.googleapis.com
|
||||
// apis: google.example.library.v1.Library
|
||||
// allow_cors: true
|
||||
// # Below entry makes 'google.example.library.v1.Library'
|
||||
// # API be served from endpoint address
|
||||
// # google.example.library-example.v1.LibraryManager.
|
||||
// - name: library-manager.googleapis.com
|
||||
// apis: google.example.library.v1.LibraryManager
|
||||
// # BNS address for a borg job. Can specify a task by appending
|
||||
// # "/taskId" (e.g. "/0") to the job spec.
|
||||
//
|
||||
// Example OpenAPI extension for endpoint with allow_cors set to true:
|
||||
//
|
||||
// {
|
||||
// "swagger": "2.0",
|
||||
// "info": {
|
||||
// "description": "A simple..."
|
||||
// },
|
||||
// "host": "MY_PROJECT_ID.appspot.com",
|
||||
// "x-google-endpoints": [{
|
||||
// "name": "MY_PROJECT_ID.appspot.com",
|
||||
// "allow_cors": "true"
|
||||
// }]
|
||||
// }
|
||||
message Endpoint {
|
||||
// The canonical name of this endpoint.
|
||||
string name = 1;
|
||||
|
||||
// DEPRECATED: This field is no longer supported. Instead of using aliases,
|
||||
// please specify multiple [google.api.Endpoint][google.api.Endpoint] for each of the intented
|
||||
// alias.
|
||||
//
|
||||
// Additional names that this endpoint will be hosted on.
|
||||
repeated string aliases = 2;
|
||||
|
||||
// The list of APIs served by this endpoint.
|
||||
repeated string apis = 3;
|
||||
|
||||
// The list of features enabled on this endpoint.
|
||||
repeated string features = 4;
|
||||
|
||||
// Allowing
|
||||
// [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka
|
||||
// cross-domain traffic, would allow the backends served from this endpoint to
|
||||
// receive and respond to HTTP OPTIONS requests. The response will be used by
|
||||
// the browser to determine whether the subsequent cross-origin request is
|
||||
// allowed to proceed.
|
||||
bool allow_cors = 5;
|
||||
}
|
535
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/http.pb.go
generated
vendored
Normal file
535
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/http.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,535 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/serviceconfig/http.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
|
||||
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
|
||||
|
||||
// Defines the HTTP configuration for a service. It contains a list of
|
||||
// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
|
||||
// to one or more HTTP REST API methods.
|
||||
type Http struct {
|
||||
// A list of HTTP configuration rules that apply to individual API methods.
|
||||
//
|
||||
// **NOTE:** All service configuration rules follow "last one wins" order.
|
||||
Rules []*HttpRule `protobuf:"bytes,1,rep,name=rules" json:"rules,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Http) Reset() { *m = Http{} }
|
||||
func (m *Http) String() string { return proto.CompactTextString(m) }
|
||||
func (*Http) ProtoMessage() {}
|
||||
func (*Http) Descriptor() ([]byte, []int) { return fileDescriptor9, []int{0} }
|
||||
|
||||
func (m *Http) GetRules() []*HttpRule {
|
||||
if m != nil {
|
||||
return m.Rules
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// `HttpRule` defines the mapping of an RPC method to one or more HTTP
|
||||
// REST APIs. The mapping determines what portions of the request
|
||||
// message are populated from the path, query parameters, or body of
|
||||
// the HTTP request. The mapping is typically specified as an
|
||||
// `google.api.http` annotation, see "google/api/annotations.proto"
|
||||
// for details.
|
||||
//
|
||||
// The mapping consists of a field specifying the path template and
|
||||
// method kind. The path template can refer to fields in the request
|
||||
// message, as in the example below which describes a REST GET
|
||||
// operation on a resource collection of messages:
|
||||
//
|
||||
// ```proto
|
||||
// service Messaging {
|
||||
// rpc GetMessage(GetMessageRequest) returns (Message) {
|
||||
// option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}";
|
||||
// }
|
||||
// }
|
||||
// message GetMessageRequest {
|
||||
// message SubMessage {
|
||||
// string subfield = 1;
|
||||
// }
|
||||
// string message_id = 1; // mapped to the URL
|
||||
// SubMessage sub = 2; // `sub.subfield` is url-mapped
|
||||
// }
|
||||
// message Message {
|
||||
// string text = 1; // content of the resource
|
||||
// }
|
||||
// ```
|
||||
//
|
||||
// This definition enables an automatic, bidrectional mapping of HTTP
|
||||
// JSON to RPC. Example:
|
||||
//
|
||||
// HTTP | RPC
|
||||
// -----|-----
|
||||
// `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))`
|
||||
//
|
||||
// In general, not only fields but also field paths can be referenced
|
||||
// from a path pattern. Fields mapped to the path pattern cannot be
|
||||
// repeated and must have a primitive (non-message) type.
|
||||
//
|
||||
// Any fields in the request message which are not bound by the path
|
||||
// pattern automatically become (optional) HTTP query
|
||||
// parameters. Assume the following definition of the request message:
|
||||
//
|
||||
// ```proto
|
||||
// message GetMessageRequest {
|
||||
// message SubMessage {
|
||||
// string subfield = 1;
|
||||
// }
|
||||
// string message_id = 1; // mapped to the URL
|
||||
// int64 revision = 2; // becomes a parameter
|
||||
// SubMessage sub = 3; // `sub.subfield` becomes a parameter
|
||||
// }
|
||||
// ```
|
||||
//
|
||||
// This enables a HTTP JSON to RPC mapping as below:
|
||||
//
|
||||
// HTTP | RPC
|
||||
// -----|-----
|
||||
// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`
|
||||
//
|
||||
// Note that fields which are mapped to HTTP parameters must have a
|
||||
// primitive type or a repeated primitive type. Message types are not
|
||||
// allowed. In the case of a repeated type, the parameter can be
|
||||
// repeated in the URL, as in `...?param=A¶m=B`.
|
||||
//
|
||||
// For HTTP method kinds which allow a request body, the `body` field
|
||||
// specifies the mapping. Consider a REST update method on the
|
||||
// message resource collection:
|
||||
//
|
||||
// ```proto
|
||||
// service Messaging {
|
||||
// rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
|
||||
// option (google.api.http) = {
|
||||
// put: "/v1/messages/{message_id}"
|
||||
// body: "message"
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
// message UpdateMessageRequest {
|
||||
// string message_id = 1; // mapped to the URL
|
||||
// Message message = 2; // mapped to the body
|
||||
// }
|
||||
// ```
|
||||
//
|
||||
// The following HTTP JSON to RPC mapping is enabled, where the
|
||||
// representation of the JSON in the request body is determined by
|
||||
// protos JSON encoding:
|
||||
//
|
||||
// HTTP | RPC
|
||||
// -----|-----
|
||||
// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
|
||||
//
|
||||
// The special name `*` can be used in the body mapping to define that
|
||||
// every field not bound by the path template should be mapped to the
|
||||
// request body. This enables the following alternative definition of
|
||||
// the update method:
|
||||
//
|
||||
// ```proto
|
||||
// service Messaging {
|
||||
// rpc UpdateMessage(Message) returns (Message) {
|
||||
// option (google.api.http) = {
|
||||
// put: "/v1/messages/{message_id}"
|
||||
// body: "*"
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
// message Message {
|
||||
// string message_id = 1;
|
||||
// string text = 2;
|
||||
// }
|
||||
// ```
|
||||
//
|
||||
// The following HTTP JSON to RPC mapping is enabled:
|
||||
//
|
||||
// HTTP | RPC
|
||||
// -----|-----
|
||||
// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")`
|
||||
//
|
||||
// Note that when using `*` in the body mapping, it is not possible to
|
||||
// have HTTP parameters, as all fields not bound by the path end in
|
||||
// the body. This makes this option more rarely used in practice of
|
||||
// defining REST APIs. The common usage of `*` is in custom methods
|
||||
// which don't use the URL at all for transferring data.
|
||||
//
|
||||
// It is possible to define multiple HTTP methods for one RPC by using
|
||||
// the `additional_bindings` option. Example:
|
||||
//
|
||||
// ```proto
|
||||
// service Messaging {
|
||||
// rpc GetMessage(GetMessageRequest) returns (Message) {
|
||||
// option (google.api.http) = {
|
||||
// get: "/v1/messages/{message_id}"
|
||||
// additional_bindings {
|
||||
// get: "/v1/users/{user_id}/messages/{message_id}"
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
// message GetMessageRequest {
|
||||
// string message_id = 1;
|
||||
// string user_id = 2;
|
||||
// }
|
||||
// ```
|
||||
//
|
||||
// This enables the following two alternative HTTP JSON to RPC
|
||||
// mappings:
|
||||
//
|
||||
// HTTP | RPC
|
||||
// -----|-----
|
||||
// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
|
||||
// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")`
|
||||
//
|
||||
// # Rules for HTTP mapping
|
||||
//
|
||||
// The rules for mapping HTTP path, query parameters, and body fields
|
||||
// to the request message are as follows:
|
||||
//
|
||||
// 1. The `body` field specifies either `*` or a field path, or is
|
||||
// omitted. If omitted, it assumes there is no HTTP body.
|
||||
// 2. Leaf fields (recursive expansion of nested messages in the
|
||||
// request) can be classified into three types:
|
||||
// (a) Matched in the URL template.
|
||||
// (b) Covered by body (if body is `*`, everything except (a) fields;
|
||||
// else everything under the body field)
|
||||
// (c) All other fields.
|
||||
// 3. URL query parameters found in the HTTP request are mapped to (c) fields.
|
||||
// 4. Any body sent with an HTTP request can contain only (b) fields.
|
||||
//
|
||||
// The syntax of the path template is as follows:
|
||||
//
|
||||
// Template = "/" Segments [ Verb ] ;
|
||||
// Segments = Segment { "/" Segment } ;
|
||||
// Segment = "*" | "**" | LITERAL | Variable ;
|
||||
// Variable = "{" FieldPath [ "=" Segments ] "}" ;
|
||||
// FieldPath = IDENT { "." IDENT } ;
|
||||
// Verb = ":" LITERAL ;
|
||||
//
|
||||
// The syntax `*` matches a single path segment. It follows the semantics of
|
||||
// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
|
||||
// Expansion.
|
||||
//
|
||||
// The syntax `**` matches zero or more path segments. It follows the semantics
|
||||
// of [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.3 Reserved
|
||||
// Expansion.
|
||||
//
|
||||
// The syntax `LITERAL` matches literal text in the URL path.
|
||||
//
|
||||
// The syntax `Variable` matches the entire path as specified by its template;
|
||||
// this nested template must not contain further variables. If a variable
|
||||
// matches a single path segment, its template may be omitted, e.g. `{var}`
|
||||
// is equivalent to `{var=*}`.
|
||||
//
|
||||
// NOTE: the field paths in variables and in the `body` must not refer to
|
||||
// repeated fields or map fields.
|
||||
//
|
||||
// Use CustomHttpPattern to specify any HTTP method that is not included in the
|
||||
// `pattern` field, such as HEAD, or "*" to leave the HTTP method unspecified for
|
||||
// a given URL path rule. The wild-card rule is useful for services that provide
|
||||
// content to Web (HTML) clients.
|
||||
type HttpRule struct {
|
||||
// Selects methods to which this rule applies.
|
||||
//
|
||||
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
||||
Selector string `protobuf:"bytes,1,opt,name=selector" json:"selector,omitempty"`
|
||||
// Determines the URL pattern is matched by this rules. This pattern can be
|
||||
// used with any of the {get|put|post|delete|patch} methods. A custom method
|
||||
// can be defined using the 'custom' field.
|
||||
//
|
||||
// Types that are valid to be assigned to Pattern:
|
||||
// *HttpRule_Get
|
||||
// *HttpRule_Put
|
||||
// *HttpRule_Post
|
||||
// *HttpRule_Delete
|
||||
// *HttpRule_Patch
|
||||
// *HttpRule_Custom
|
||||
Pattern isHttpRule_Pattern `protobuf_oneof:"pattern"`
|
||||
// The name of the request field whose value is mapped to the HTTP body, or
|
||||
// `*` for mapping all fields not captured by the path pattern to the HTTP
|
||||
// body. NOTE: the referred field must not be a repeated field and must be
|
||||
// present at the top-level of response message type.
|
||||
Body string `protobuf:"bytes,7,opt,name=body" json:"body,omitempty"`
|
||||
// Additional HTTP bindings for the selector. Nested bindings must
|
||||
// not contain an `additional_bindings` field themselves (that is,
|
||||
// the nesting may only be one level deep).
|
||||
AdditionalBindings []*HttpRule `protobuf:"bytes,11,rep,name=additional_bindings,json=additionalBindings" json:"additional_bindings,omitempty"`
|
||||
}
|
||||
|
||||
func (m *HttpRule) Reset() { *m = HttpRule{} }
|
||||
func (m *HttpRule) String() string { return proto.CompactTextString(m) }
|
||||
func (*HttpRule) ProtoMessage() {}
|
||||
func (*HttpRule) Descriptor() ([]byte, []int) { return fileDescriptor9, []int{1} }
|
||||
|
||||
type isHttpRule_Pattern interface {
|
||||
isHttpRule_Pattern()
|
||||
}
|
||||
|
||||
type HttpRule_Get struct {
|
||||
Get string `protobuf:"bytes,2,opt,name=get,oneof"`
|
||||
}
|
||||
type HttpRule_Put struct {
|
||||
Put string `protobuf:"bytes,3,opt,name=put,oneof"`
|
||||
}
|
||||
type HttpRule_Post struct {
|
||||
Post string `protobuf:"bytes,4,opt,name=post,oneof"`
|
||||
}
|
||||
type HttpRule_Delete struct {
|
||||
Delete string `protobuf:"bytes,5,opt,name=delete,oneof"`
|
||||
}
|
||||
type HttpRule_Patch struct {
|
||||
Patch string `protobuf:"bytes,6,opt,name=patch,oneof"`
|
||||
}
|
||||
type HttpRule_Custom struct {
|
||||
Custom *CustomHttpPattern `protobuf:"bytes,8,opt,name=custom,oneof"`
|
||||
}
|
||||
|
||||
func (*HttpRule_Get) isHttpRule_Pattern() {}
|
||||
func (*HttpRule_Put) isHttpRule_Pattern() {}
|
||||
func (*HttpRule_Post) isHttpRule_Pattern() {}
|
||||
func (*HttpRule_Delete) isHttpRule_Pattern() {}
|
||||
func (*HttpRule_Patch) isHttpRule_Pattern() {}
|
||||
func (*HttpRule_Custom) isHttpRule_Pattern() {}
|
||||
|
||||
func (m *HttpRule) GetPattern() isHttpRule_Pattern {
|
||||
if m != nil {
|
||||
return m.Pattern
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *HttpRule) GetGet() string {
|
||||
if x, ok := m.GetPattern().(*HttpRule_Get); ok {
|
||||
return x.Get
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *HttpRule) GetPut() string {
|
||||
if x, ok := m.GetPattern().(*HttpRule_Put); ok {
|
||||
return x.Put
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *HttpRule) GetPost() string {
|
||||
if x, ok := m.GetPattern().(*HttpRule_Post); ok {
|
||||
return x.Post
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *HttpRule) GetDelete() string {
|
||||
if x, ok := m.GetPattern().(*HttpRule_Delete); ok {
|
||||
return x.Delete
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *HttpRule) GetPatch() string {
|
||||
if x, ok := m.GetPattern().(*HttpRule_Patch); ok {
|
||||
return x.Patch
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *HttpRule) GetCustom() *CustomHttpPattern {
|
||||
if x, ok := m.GetPattern().(*HttpRule_Custom); ok {
|
||||
return x.Custom
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *HttpRule) GetAdditionalBindings() []*HttpRule {
|
||||
if m != nil {
|
||||
return m.AdditionalBindings
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*HttpRule) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
|
||||
return _HttpRule_OneofMarshaler, _HttpRule_OneofUnmarshaler, _HttpRule_OneofSizer, []interface{}{
|
||||
(*HttpRule_Get)(nil),
|
||||
(*HttpRule_Put)(nil),
|
||||
(*HttpRule_Post)(nil),
|
||||
(*HttpRule_Delete)(nil),
|
||||
(*HttpRule_Patch)(nil),
|
||||
(*HttpRule_Custom)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _HttpRule_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*HttpRule)
|
||||
// pattern
|
||||
switch x := m.Pattern.(type) {
|
||||
case *HttpRule_Get:
|
||||
b.EncodeVarint(2<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.Get)
|
||||
case *HttpRule_Put:
|
||||
b.EncodeVarint(3<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.Put)
|
||||
case *HttpRule_Post:
|
||||
b.EncodeVarint(4<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.Post)
|
||||
case *HttpRule_Delete:
|
||||
b.EncodeVarint(5<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.Delete)
|
||||
case *HttpRule_Patch:
|
||||
b.EncodeVarint(6<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.Patch)
|
||||
case *HttpRule_Custom:
|
||||
b.EncodeVarint(8<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.Custom); err != nil {
|
||||
return err
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("HttpRule.Pattern has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _HttpRule_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*HttpRule)
|
||||
switch tag {
|
||||
case 2: // pattern.get
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.Pattern = &HttpRule_Get{x}
|
||||
return true, err
|
||||
case 3: // pattern.put
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.Pattern = &HttpRule_Put{x}
|
||||
return true, err
|
||||
case 4: // pattern.post
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.Pattern = &HttpRule_Post{x}
|
||||
return true, err
|
||||
case 5: // pattern.delete
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.Pattern = &HttpRule_Delete{x}
|
||||
return true, err
|
||||
case 6: // pattern.patch
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.Pattern = &HttpRule_Patch{x}
|
||||
return true, err
|
||||
case 8: // pattern.custom
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(CustomHttpPattern)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Pattern = &HttpRule_Custom{msg}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _HttpRule_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*HttpRule)
|
||||
// pattern
|
||||
switch x := m.Pattern.(type) {
|
||||
case *HttpRule_Get:
|
||||
n += proto.SizeVarint(2<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(len(x.Get)))
|
||||
n += len(x.Get)
|
||||
case *HttpRule_Put:
|
||||
n += proto.SizeVarint(3<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(len(x.Put)))
|
||||
n += len(x.Put)
|
||||
case *HttpRule_Post:
|
||||
n += proto.SizeVarint(4<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(len(x.Post)))
|
||||
n += len(x.Post)
|
||||
case *HttpRule_Delete:
|
||||
n += proto.SizeVarint(5<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(len(x.Delete)))
|
||||
n += len(x.Delete)
|
||||
case *HttpRule_Patch:
|
||||
n += proto.SizeVarint(6<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(len(x.Patch)))
|
||||
n += len(x.Patch)
|
||||
case *HttpRule_Custom:
|
||||
s := proto.Size(x.Custom)
|
||||
n += proto.SizeVarint(8<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// A custom pattern is used for defining custom HTTP verb.
|
||||
type CustomHttpPattern struct {
|
||||
// The name of this custom HTTP verb.
|
||||
Kind string `protobuf:"bytes,1,opt,name=kind" json:"kind,omitempty"`
|
||||
// The path matched by this custom verb.
|
||||
Path string `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"`
|
||||
}
|
||||
|
||||
func (m *CustomHttpPattern) Reset() { *m = CustomHttpPattern{} }
|
||||
func (m *CustomHttpPattern) String() string { return proto.CompactTextString(m) }
|
||||
func (*CustomHttpPattern) ProtoMessage() {}
|
||||
func (*CustomHttpPattern) Descriptor() ([]byte, []int) { return fileDescriptor9, []int{2} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Http)(nil), "google.api.Http")
|
||||
proto.RegisterType((*HttpRule)(nil), "google.api.HttpRule")
|
||||
proto.RegisterType((*CustomHttpPattern)(nil), "google.api.CustomHttpPattern")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/serviceconfig/http.proto", fileDescriptor9)
|
||||
}
|
||||
|
||||
var fileDescriptor9 = []byte{
|
||||
// 348 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x51, 0xcd, 0x4a, 0x2b, 0x31,
|
||||
0x14, 0xbe, 0xd3, 0x4e, 0xa7, 0xed, 0x29, 0x5c, 0xb8, 0xb9, 0x45, 0x82, 0x20, 0x48, 0x37, 0x16,
|
||||
0x17, 0x33, 0x50, 0x17, 0x2e, 0x5c, 0x39, 0x22, 0xd6, 0x5d, 0x99, 0x17, 0x90, 0xe9, 0x4c, 0x4c,
|
||||
0x83, 0xd3, 0x24, 0x4c, 0x4e, 0x05, 0x5f, 0xc7, 0x77, 0xf0, 0xdd, 0x5c, 0x9a, 0x64, 0x52, 0x5b,
|
||||
0x10, 0xdc, 0x84, 0xf3, 0xfd, 0x9c, 0x9f, 0x9c, 0x03, 0x39, 0x57, 0x8a, 0x37, 0x2c, 0xe5, 0xaa,
|
||||
0x29, 0x25, 0x4f, 0x55, 0xcb, 0x33, 0xce, 0xa4, 0x6e, 0x15, 0xaa, 0xac, 0x93, 0x4a, 0x2d, 0x4c,
|
||||
0x66, 0x9f, 0xcc, 0xb0, 0xf6, 0x55, 0x54, 0xac, 0x52, 0xf2, 0x59, 0xf0, 0x6c, 0x83, 0xa8, 0x53,
|
||||
0xef, 0x23, 0x10, 0x6a, 0x58, 0xd3, 0x6c, 0x01, 0xf1, 0xd2, 0x2a, 0xe4, 0x12, 0x06, 0xed, 0xae,
|
||||
0x61, 0x86, 0x46, 0xe7, 0xfd, 0xf9, 0x64, 0x31, 0x4d, 0x0f, 0x9e, 0xd4, 0x19, 0x0a, 0x2b, 0x16,
|
||||
0x9d, 0x65, 0xf6, 0xd1, 0x83, 0xd1, 0x9e, 0x23, 0xa7, 0x30, 0x32, 0xac, 0x61, 0x15, 0xaa, 0xd6,
|
||||
0xe6, 0x46, 0xf3, 0x71, 0xf1, 0x8d, 0x09, 0x81, 0x3e, 0x67, 0x48, 0x7b, 0x8e, 0x5e, 0xfe, 0x29,
|
||||
0x1c, 0x70, 0x9c, 0xde, 0x21, 0xed, 0xef, 0x39, 0x0b, 0xc8, 0x14, 0x62, 0xad, 0x0c, 0xd2, 0x38,
|
||||
0x90, 0x1e, 0x11, 0x0a, 0x49, 0x6d, 0x2b, 0x21, 0xa3, 0x83, 0xc0, 0x07, 0x4c, 0x4e, 0x60, 0xa0,
|
||||
0x4b, 0xac, 0x36, 0x34, 0x09, 0x42, 0x07, 0xc9, 0x35, 0x24, 0xd5, 0xce, 0xa0, 0xda, 0xd2, 0x91,
|
||||
0x15, 0x26, 0x8b, 0xb3, 0xe3, 0x5f, 0xdc, 0x79, 0xc5, 0xcd, 0xbd, 0x2a, 0x11, 0x59, 0x2b, 0x5d,
|
||||
0xc1, 0xce, 0x6e, 0x87, 0x8a, 0xd7, 0xaa, 0x7e, 0xa3, 0x43, 0xff, 0x01, 0x1f, 0x93, 0x7b, 0xf8,
|
||||
0x5f, 0xd6, 0xb5, 0x40, 0xa1, 0x64, 0xd9, 0x3c, 0xad, 0x85, 0xac, 0x85, 0xe4, 0x86, 0x4e, 0x7e,
|
||||
0xd9, 0x0f, 0x39, 0x24, 0xe4, 0xc1, 0x9f, 0x8f, 0x61, 0xa8, 0xbb, 0x7e, 0xb3, 0x1b, 0xf8, 0xf7,
|
||||
0x63, 0x08, 0xd7, 0xfa, 0xc5, 0x7a, 0xc3, 0xee, 0x7c, 0xec, 0x38, 0x9b, 0xb3, 0xe9, 0x16, 0x57,
|
||||
0xf8, 0x38, 0xbf, 0x80, 0xbf, 0x95, 0xda, 0x1e, 0xb5, 0xcd, 0xc7, 0xbe, 0x8c, 0xbb, 0xe8, 0x2a,
|
||||
0xfa, 0x8c, 0xa2, 0xf7, 0x5e, 0xfc, 0x70, 0xbb, 0x7a, 0x5c, 0x27, 0xfe, 0xc8, 0x57, 0x5f, 0x01,
|
||||
0x00, 0x00, 0xff, 0xff, 0x32, 0x48, 0x5c, 0x87, 0x2a, 0x02, 0x00, 0x00,
|
||||
}
|
285
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/http.proto
generated
vendored
Normal file
285
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/http.proto
generated
vendored
Normal file
|
@ -0,0 +1,285 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "HttpProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
|
||||
// Defines the HTTP configuration for a service. It contains a list of
|
||||
// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
|
||||
// to one or more HTTP REST API methods.
|
||||
message Http {
|
||||
// A list of HTTP configuration rules that apply to individual API methods.
|
||||
//
|
||||
// **NOTE:** All service configuration rules follow "last one wins" order.
|
||||
repeated HttpRule rules = 1;
|
||||
}
|
||||
|
||||
// `HttpRule` defines the mapping of an RPC method to one or more HTTP
|
||||
// REST APIs. The mapping determines what portions of the request
|
||||
// message are populated from the path, query parameters, or body of
|
||||
// the HTTP request. The mapping is typically specified as an
|
||||
// `google.api.http` annotation, see "google/api/annotations.proto"
|
||||
// for details.
|
||||
//
|
||||
// The mapping consists of a field specifying the path template and
|
||||
// method kind. The path template can refer to fields in the request
|
||||
// message, as in the example below which describes a REST GET
|
||||
// operation on a resource collection of messages:
|
||||
//
|
||||
// ```proto
|
||||
// service Messaging {
|
||||
// rpc GetMessage(GetMessageRequest) returns (Message) {
|
||||
// option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}";
|
||||
// }
|
||||
// }
|
||||
// message GetMessageRequest {
|
||||
// message SubMessage {
|
||||
// string subfield = 1;
|
||||
// }
|
||||
// string message_id = 1; // mapped to the URL
|
||||
// SubMessage sub = 2; // `sub.subfield` is url-mapped
|
||||
// }
|
||||
// message Message {
|
||||
// string text = 1; // content of the resource
|
||||
// }
|
||||
// ```
|
||||
//
|
||||
// This definition enables an automatic, bidrectional mapping of HTTP
|
||||
// JSON to RPC. Example:
|
||||
//
|
||||
// HTTP | RPC
|
||||
// -----|-----
|
||||
// `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))`
|
||||
//
|
||||
// In general, not only fields but also field paths can be referenced
|
||||
// from a path pattern. Fields mapped to the path pattern cannot be
|
||||
// repeated and must have a primitive (non-message) type.
|
||||
//
|
||||
// Any fields in the request message which are not bound by the path
|
||||
// pattern automatically become (optional) HTTP query
|
||||
// parameters. Assume the following definition of the request message:
|
||||
//
|
||||
// ```proto
|
||||
// message GetMessageRequest {
|
||||
// message SubMessage {
|
||||
// string subfield = 1;
|
||||
// }
|
||||
// string message_id = 1; // mapped to the URL
|
||||
// int64 revision = 2; // becomes a parameter
|
||||
// SubMessage sub = 3; // `sub.subfield` becomes a parameter
|
||||
// }
|
||||
// ```
|
||||
//
|
||||
// This enables a HTTP JSON to RPC mapping as below:
|
||||
//
|
||||
// HTTP | RPC
|
||||
// -----|-----
|
||||
// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`
|
||||
//
|
||||
// Note that fields which are mapped to HTTP parameters must have a
|
||||
// primitive type or a repeated primitive type. Message types are not
|
||||
// allowed. In the case of a repeated type, the parameter can be
|
||||
// repeated in the URL, as in `...?param=A¶m=B`.
|
||||
//
|
||||
// For HTTP method kinds which allow a request body, the `body` field
|
||||
// specifies the mapping. Consider a REST update method on the
|
||||
// message resource collection:
|
||||
//
|
||||
// ```proto
|
||||
// service Messaging {
|
||||
// rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
|
||||
// option (google.api.http) = {
|
||||
// put: "/v1/messages/{message_id}"
|
||||
// body: "message"
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
// message UpdateMessageRequest {
|
||||
// string message_id = 1; // mapped to the URL
|
||||
// Message message = 2; // mapped to the body
|
||||
// }
|
||||
// ```
|
||||
//
|
||||
// The following HTTP JSON to RPC mapping is enabled, where the
|
||||
// representation of the JSON in the request body is determined by
|
||||
// protos JSON encoding:
|
||||
//
|
||||
// HTTP | RPC
|
||||
// -----|-----
|
||||
// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
|
||||
//
|
||||
// The special name `*` can be used in the body mapping to define that
|
||||
// every field not bound by the path template should be mapped to the
|
||||
// request body. This enables the following alternative definition of
|
||||
// the update method:
|
||||
//
|
||||
// ```proto
|
||||
// service Messaging {
|
||||
// rpc UpdateMessage(Message) returns (Message) {
|
||||
// option (google.api.http) = {
|
||||
// put: "/v1/messages/{message_id}"
|
||||
// body: "*"
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
// message Message {
|
||||
// string message_id = 1;
|
||||
// string text = 2;
|
||||
// }
|
||||
// ```
|
||||
//
|
||||
// The following HTTP JSON to RPC mapping is enabled:
|
||||
//
|
||||
// HTTP | RPC
|
||||
// -----|-----
|
||||
// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")`
|
||||
//
|
||||
// Note that when using `*` in the body mapping, it is not possible to
|
||||
// have HTTP parameters, as all fields not bound by the path end in
|
||||
// the body. This makes this option more rarely used in practice of
|
||||
// defining REST APIs. The common usage of `*` is in custom methods
|
||||
// which don't use the URL at all for transferring data.
|
||||
//
|
||||
// It is possible to define multiple HTTP methods for one RPC by using
|
||||
// the `additional_bindings` option. Example:
|
||||
//
|
||||
// ```proto
|
||||
// service Messaging {
|
||||
// rpc GetMessage(GetMessageRequest) returns (Message) {
|
||||
// option (google.api.http) = {
|
||||
// get: "/v1/messages/{message_id}"
|
||||
// additional_bindings {
|
||||
// get: "/v1/users/{user_id}/messages/{message_id}"
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
// message GetMessageRequest {
|
||||
// string message_id = 1;
|
||||
// string user_id = 2;
|
||||
// }
|
||||
// ```
|
||||
//
|
||||
// This enables the following two alternative HTTP JSON to RPC
|
||||
// mappings:
|
||||
//
|
||||
// HTTP | RPC
|
||||
// -----|-----
|
||||
// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
|
||||
// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")`
|
||||
//
|
||||
// # Rules for HTTP mapping
|
||||
//
|
||||
// The rules for mapping HTTP path, query parameters, and body fields
|
||||
// to the request message are as follows:
|
||||
//
|
||||
// 1. The `body` field specifies either `*` or a field path, or is
|
||||
// omitted. If omitted, it assumes there is no HTTP body.
|
||||
// 2. Leaf fields (recursive expansion of nested messages in the
|
||||
// request) can be classified into three types:
|
||||
// (a) Matched in the URL template.
|
||||
// (b) Covered by body (if body is `*`, everything except (a) fields;
|
||||
// else everything under the body field)
|
||||
// (c) All other fields.
|
||||
// 3. URL query parameters found in the HTTP request are mapped to (c) fields.
|
||||
// 4. Any body sent with an HTTP request can contain only (b) fields.
|
||||
//
|
||||
// The syntax of the path template is as follows:
|
||||
//
|
||||
// Template = "/" Segments [ Verb ] ;
|
||||
// Segments = Segment { "/" Segment } ;
|
||||
// Segment = "*" | "**" | LITERAL | Variable ;
|
||||
// Variable = "{" FieldPath [ "=" Segments ] "}" ;
|
||||
// FieldPath = IDENT { "." IDENT } ;
|
||||
// Verb = ":" LITERAL ;
|
||||
//
|
||||
// The syntax `*` matches a single path segment. It follows the semantics of
|
||||
// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
|
||||
// Expansion.
|
||||
//
|
||||
// The syntax `**` matches zero or more path segments. It follows the semantics
|
||||
// of [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.3 Reserved
|
||||
// Expansion.
|
||||
//
|
||||
// The syntax `LITERAL` matches literal text in the URL path.
|
||||
//
|
||||
// The syntax `Variable` matches the entire path as specified by its template;
|
||||
// this nested template must not contain further variables. If a variable
|
||||
// matches a single path segment, its template may be omitted, e.g. `{var}`
|
||||
// is equivalent to `{var=*}`.
|
||||
//
|
||||
// NOTE: the field paths in variables and in the `body` must not refer to
|
||||
// repeated fields or map fields.
|
||||
//
|
||||
// Use CustomHttpPattern to specify any HTTP method that is not included in the
|
||||
// `pattern` field, such as HEAD, or "*" to leave the HTTP method unspecified for
|
||||
// a given URL path rule. The wild-card rule is useful for services that provide
|
||||
// content to Web (HTML) clients.
|
||||
message HttpRule {
|
||||
// Selects methods to which this rule applies.
|
||||
//
|
||||
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
||||
string selector = 1;
|
||||
|
||||
// Determines the URL pattern is matched by this rules. This pattern can be
|
||||
// used with any of the {get|put|post|delete|patch} methods. A custom method
|
||||
// can be defined using the 'custom' field.
|
||||
oneof pattern {
|
||||
// Used for listing and getting information about resources.
|
||||
string get = 2;
|
||||
|
||||
// Used for updating a resource.
|
||||
string put = 3;
|
||||
|
||||
// Used for creating a resource.
|
||||
string post = 4;
|
||||
|
||||
// Used for deleting a resource.
|
||||
string delete = 5;
|
||||
|
||||
// Used for updating a resource.
|
||||
string patch = 6;
|
||||
|
||||
// Custom pattern is used for defining custom verbs.
|
||||
CustomHttpPattern custom = 8;
|
||||
}
|
||||
|
||||
// The name of the request field whose value is mapped to the HTTP body, or
|
||||
// `*` for mapping all fields not captured by the path pattern to the HTTP
|
||||
// body. NOTE: the referred field must not be a repeated field and must be
|
||||
// present at the top-level of response message type.
|
||||
string body = 7;
|
||||
|
||||
// Additional HTTP bindings for the selector. Nested bindings must
|
||||
// not contain an `additional_bindings` field themselves (that is,
|
||||
// the nesting may only be one level deep).
|
||||
repeated HttpRule additional_bindings = 11;
|
||||
}
|
||||
|
||||
// A custom pattern is used for defining custom HTTP verb.
|
||||
message CustomHttpPattern {
|
||||
// The name of this custom HTTP verb.
|
||||
string kind = 1;
|
||||
|
||||
// The path matched by this custom verb.
|
||||
string path = 2;
|
||||
}
|
80
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/log.pb.go
generated
vendored
Normal file
80
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/log.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/serviceconfig/log.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import google_api1 "google.golang.org/genproto/googleapis/api/label"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// A description of a log type. Example in YAML format:
|
||||
//
|
||||
// - name: library.googleapis.com/activity_history
|
||||
// description: The history of borrowing and returning library items.
|
||||
// display_name: Activity
|
||||
// labels:
|
||||
// - key: /customer_id
|
||||
// description: Identifier of a library customer
|
||||
type LogDescriptor struct {
|
||||
// The name of the log. It must be less than 512 characters long and can
|
||||
// include the following characters: upper- and lower-case alphanumeric
|
||||
// characters [A-Za-z0-9], and punctuation characters including
|
||||
// slash, underscore, hyphen, period [/_-.].
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// The set of labels that are available to describe a specific log entry.
|
||||
// Runtime requests that contain labels not specified here are
|
||||
// considered invalid.
|
||||
Labels []*google_api1.LabelDescriptor `protobuf:"bytes,2,rep,name=labels" json:"labels,omitempty"`
|
||||
// A human-readable description of this log. This information appears in
|
||||
// the documentation and can contain details.
|
||||
Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
|
||||
// The human-readable name for this log. This information appears on
|
||||
// the user interface and should be concise.
|
||||
DisplayName string `protobuf:"bytes,4,opt,name=display_name,json=displayName" json:"display_name,omitempty"`
|
||||
}
|
||||
|
||||
func (m *LogDescriptor) Reset() { *m = LogDescriptor{} }
|
||||
func (m *LogDescriptor) String() string { return proto.CompactTextString(m) }
|
||||
func (*LogDescriptor) ProtoMessage() {}
|
||||
func (*LogDescriptor) Descriptor() ([]byte, []int) { return fileDescriptor10, []int{0} }
|
||||
|
||||
func (m *LogDescriptor) GetLabels() []*google_api1.LabelDescriptor {
|
||||
if m != nil {
|
||||
return m.Labels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*LogDescriptor)(nil), "google.api.LogDescriptor")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/serviceconfig/log.proto", fileDescriptor10)
|
||||
}
|
||||
|
||||
var fileDescriptor10 = []byte{
|
||||
// 233 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x72, 0x4c, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0x4b, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0xcb, 0x2f, 0x4a, 0xd7, 0x4f, 0x4f,
|
||||
0xcd, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x87, 0x48, 0x25, 0x16, 0x64, 0x16, 0xeb, 0x03, 0x09,
|
||||
0xfd, 0xe2, 0xd4, 0xa2, 0xb2, 0xcc, 0xe4, 0xd4, 0xe4, 0xfc, 0xbc, 0xb4, 0xcc, 0x74, 0xfd, 0x9c,
|
||||
0xfc, 0x74, 0x3d, 0xb0, 0x32, 0x21, 0x2e, 0xa8, 0x11, 0x40, 0x35, 0x52, 0xd6, 0xc4, 0x1b, 0x97,
|
||||
0x93, 0x98, 0x94, 0x9a, 0x03, 0x21, 0x21, 0x06, 0x29, 0xcd, 0x65, 0xe4, 0xe2, 0xf5, 0xc9, 0x4f,
|
||||
0x77, 0x49, 0x2d, 0x4e, 0x2e, 0xca, 0x2c, 0x28, 0xc9, 0x2f, 0x12, 0x12, 0xe2, 0x62, 0xc9, 0x4b,
|
||||
0xcc, 0x4d, 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x02, 0xb3, 0x85, 0x8c, 0xb9, 0xd8, 0xc0,
|
||||
0x9a, 0x8a, 0x25, 0x98, 0x14, 0x98, 0x35, 0xb8, 0x8d, 0xa4, 0xf5, 0x10, 0xf6, 0xeb, 0xf9, 0x80,
|
||||
0x64, 0x10, 0x06, 0x04, 0x41, 0x95, 0x0a, 0x29, 0x70, 0x71, 0xa7, 0x40, 0x45, 0x33, 0xf3, 0xf3,
|
||||
0x24, 0x98, 0xc1, 0xe6, 0x21, 0x0b, 0x09, 0x29, 0x72, 0xf1, 0xa4, 0x64, 0x16, 0x17, 0xe4, 0x24,
|
||||
0x56, 0xc6, 0x83, 0xad, 0x64, 0x81, 0x2a, 0x81, 0x88, 0xf9, 0x01, 0x85, 0x9c, 0x94, 0xb9, 0xf8,
|
||||
0x92, 0xf3, 0x73, 0x91, 0xac, 0x73, 0xe2, 0x00, 0x3a, 0x37, 0x00, 0xe4, 0xf6, 0x00, 0xc6, 0x45,
|
||||
0x4c, 0x2c, 0xee, 0x8e, 0x01, 0x9e, 0x49, 0x6c, 0x60, 0xbf, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff,
|
||||
0xff, 0x32, 0x96, 0x08, 0x72, 0x59, 0x01, 0x00, 0x00,
|
||||
}
|
54
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/log.proto
generated
vendored
Normal file
54
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/log.proto
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
import "google.golang.org/genproto/googleapis/api/label/label.proto"; // from google/api/label.proto
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "LogProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
|
||||
// A description of a log type. Example in YAML format:
|
||||
//
|
||||
// - name: library.googleapis.com/activity_history
|
||||
// description: The history of borrowing and returning library items.
|
||||
// display_name: Activity
|
||||
// labels:
|
||||
// - key: /customer_id
|
||||
// description: Identifier of a library customer
|
||||
message LogDescriptor {
|
||||
// The name of the log. It must be less than 512 characters long and can
|
||||
// include the following characters: upper- and lower-case alphanumeric
|
||||
// characters [A-Za-z0-9], and punctuation characters including
|
||||
// slash, underscore, hyphen, period [/_-.].
|
||||
string name = 1;
|
||||
|
||||
// The set of labels that are available to describe a specific log entry.
|
||||
// Runtime requests that contain labels not specified here are
|
||||
// considered invalid.
|
||||
repeated LabelDescriptor labels = 2;
|
||||
|
||||
// A human-readable description of this log. This information appears in
|
||||
// the documentation and can contain details.
|
||||
string description = 3;
|
||||
|
||||
// The human-readable name for this log. This information appears on
|
||||
// the user interface and should be concise.
|
||||
string display_name = 4;
|
||||
}
|
123
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/logging.pb.go
generated
vendored
Normal file
123
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/logging.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,123 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/serviceconfig/logging.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
|
||||
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
|
||||
|
||||
// Logging configuration of the service.
|
||||
//
|
||||
// The following example shows how to configure logs to be sent to the
|
||||
// producer and consumer projects. In the example,
|
||||
// the `library.googleapis.com/activity_history` log is
|
||||
// sent to both the producer and consumer projects, whereas
|
||||
// the `library.googleapis.com/purchase_history` log is only sent to the
|
||||
// producer project:
|
||||
//
|
||||
// monitored_resources:
|
||||
// - type: library.googleapis.com/branch
|
||||
// labels:
|
||||
// - key: /city
|
||||
// description: The city where the library branch is located in.
|
||||
// - key: /name
|
||||
// description: The name of the branch.
|
||||
// logs:
|
||||
// - name: library.googleapis.com/activity_history
|
||||
// labels:
|
||||
// - key: /customer_id
|
||||
// - name: library.googleapis.com/purchase_history
|
||||
// logging:
|
||||
// producer_destinations:
|
||||
// - monitored_resource: library.googleapis.com/branch
|
||||
// logs:
|
||||
// - library.googleapis.com/activity_history
|
||||
// - library.googleapis.com/purchase_history
|
||||
// consumer_destinations:
|
||||
// - monitored_resource: library.googleapis.com/branch
|
||||
// logs:
|
||||
// - library.googleapis.com/activity_history
|
||||
type Logging struct {
|
||||
// Logging configurations for sending logs to the producer project.
|
||||
// There can be multiple producer destinations, each one must have a
|
||||
// different monitored resource type. A log can be used in at most
|
||||
// one producer destination.
|
||||
ProducerDestinations []*Logging_LoggingDestination `protobuf:"bytes,1,rep,name=producer_destinations,json=producerDestinations" json:"producer_destinations,omitempty"`
|
||||
// Logging configurations for sending logs to the consumer project.
|
||||
// There can be multiple consumer destinations, each one must have a
|
||||
// different monitored resource type. A log can be used in at most
|
||||
// one consumer destination.
|
||||
ConsumerDestinations []*Logging_LoggingDestination `protobuf:"bytes,2,rep,name=consumer_destinations,json=consumerDestinations" json:"consumer_destinations,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Logging) Reset() { *m = Logging{} }
|
||||
func (m *Logging) String() string { return proto.CompactTextString(m) }
|
||||
func (*Logging) ProtoMessage() {}
|
||||
func (*Logging) Descriptor() ([]byte, []int) { return fileDescriptor11, []int{0} }
|
||||
|
||||
func (m *Logging) GetProducerDestinations() []*Logging_LoggingDestination {
|
||||
if m != nil {
|
||||
return m.ProducerDestinations
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Logging) GetConsumerDestinations() []*Logging_LoggingDestination {
|
||||
if m != nil {
|
||||
return m.ConsumerDestinations
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Configuration of a specific logging destination (the producer project
|
||||
// or the consumer project).
|
||||
type Logging_LoggingDestination struct {
|
||||
// The monitored resource type. The type must be defined in
|
||||
// [Service.monitored_resources][google.api.Service.monitored_resources] section.
|
||||
MonitoredResource string `protobuf:"bytes,3,opt,name=monitored_resource,json=monitoredResource" json:"monitored_resource,omitempty"`
|
||||
// Names of the logs to be sent to this destination. Each name must
|
||||
// be defined in the [Service.logs][google.api.Service.logs] section.
|
||||
Logs []string `protobuf:"bytes,1,rep,name=logs" json:"logs,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Logging_LoggingDestination) Reset() { *m = Logging_LoggingDestination{} }
|
||||
func (m *Logging_LoggingDestination) String() string { return proto.CompactTextString(m) }
|
||||
func (*Logging_LoggingDestination) ProtoMessage() {}
|
||||
func (*Logging_LoggingDestination) Descriptor() ([]byte, []int) { return fileDescriptor11, []int{0, 0} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Logging)(nil), "google.api.Logging")
|
||||
proto.RegisterType((*Logging_LoggingDestination)(nil), "google.api.Logging.LoggingDestination")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/serviceconfig/logging.proto", fileDescriptor11)
|
||||
}
|
||||
|
||||
var fileDescriptor11 = []byte{
|
||||
// 264 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x90, 0xc1, 0x4a, 0xc4, 0x30,
|
||||
0x10, 0x86, 0x69, 0x77, 0x51, 0x36, 0x8a, 0x60, 0x50, 0x58, 0xf6, 0xb4, 0x78, 0xd0, 0xbd, 0xd8,
|
||||
0x80, 0x3e, 0x81, 0x8b, 0x22, 0x0b, 0x1e, 0x4a, 0x2f, 0x1e, 0x3c, 0x2c, 0x35, 0x1d, 0x87, 0x40,
|
||||
0x9b, 0x59, 0x92, 0xd4, 0xa7, 0xf1, 0xe4, 0x93, 0x9a, 0x6d, 0x52, 0x5b, 0xf4, 0xa4, 0x97, 0x24,
|
||||
0xcc, 0xfc, 0xf3, 0xcd, 0x9f, 0x9f, 0x3d, 0x20, 0x11, 0xd6, 0x90, 0x21, 0xd5, 0xa5, 0xc6, 0x8c,
|
||||
0x0c, 0x0a, 0x04, 0xbd, 0x33, 0xe4, 0x48, 0x84, 0x56, 0xb9, 0x53, 0x56, 0xf8, 0x43, 0x58, 0x30,
|
||||
0xef, 0x4a, 0x82, 0x24, 0xfd, 0xa6, 0x50, 0xd4, 0x84, 0xa8, 0xfc, 0x44, 0x27, 0xe5, 0x2c, 0x62,
|
||||
0xbc, 0x6e, 0xb1, 0xf9, 0x2f, 0xb2, 0xd4, 0x9a, 0x5c, 0xe9, 0x14, 0x69, 0x1b, 0xb0, 0x17, 0x1f,
|
||||
0x29, 0x3b, 0x7c, 0x0a, 0x8b, 0xf8, 0x0b, 0x3b, 0xf7, 0xc5, 0xaa, 0x95, 0x60, 0xb6, 0x15, 0x58,
|
||||
0xa7, 0x74, 0x90, 0xce, 0x93, 0xe5, 0x64, 0x75, 0x74, 0x73, 0x99, 0x0d, 0x16, 0xb2, 0x38, 0xd3,
|
||||
0xdf, 0xf7, 0x83, 0xbc, 0x38, 0xeb, 0x21, 0xa3, 0xa2, 0xdd, 0xc3, 0xbd, 0x09, 0xdb, 0x36, 0x3f,
|
||||
0xe1, 0xe9, 0xdf, 0xe0, 0x3d, 0x64, 0x0c, 0x5f, 0x3c, 0x33, 0xfe, 0x5b, 0xcb, 0xaf, 0x19, 0x6f,
|
||||
0x48, 0x2b, 0x47, 0x06, 0xaa, 0xad, 0x01, 0x4b, 0xad, 0x91, 0x30, 0x9f, 0x2c, 0x93, 0xd5, 0xac,
|
||||
0x38, 0xfd, 0xee, 0x14, 0xb1, 0xc1, 0x39, 0x9b, 0xfa, 0xc8, 0xc3, 0x6f, 0x67, 0x45, 0xf7, 0x5e,
|
||||
0x5f, 0xb1, 0x13, 0x49, 0xcd, 0xc8, 0xdb, 0xfa, 0x38, 0x2e, 0xca, 0xf7, 0xf1, 0xe5, 0xc9, 0x67,
|
||||
0x3a, 0x7d, 0xbc, 0xcb, 0x37, 0xaf, 0x07, 0x5d, 0x9c, 0xb7, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff,
|
||||
0x48, 0x22, 0x03, 0x10, 0xee, 0x01, 0x00, 0x00,
|
||||
}
|
82
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/logging.proto
generated
vendored
Normal file
82
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/logging.proto
generated
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto"; // from google/api/annotations.proto
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "LoggingProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
|
||||
// Logging configuration of the service.
|
||||
//
|
||||
// The following example shows how to configure logs to be sent to the
|
||||
// producer and consumer projects. In the example,
|
||||
// the `library.googleapis.com/activity_history` log is
|
||||
// sent to both the producer and consumer projects, whereas
|
||||
// the `library.googleapis.com/purchase_history` log is only sent to the
|
||||
// producer project:
|
||||
//
|
||||
// monitored_resources:
|
||||
// - type: library.googleapis.com/branch
|
||||
// labels:
|
||||
// - key: /city
|
||||
// description: The city where the library branch is located in.
|
||||
// - key: /name
|
||||
// description: The name of the branch.
|
||||
// logs:
|
||||
// - name: library.googleapis.com/activity_history
|
||||
// labels:
|
||||
// - key: /customer_id
|
||||
// - name: library.googleapis.com/purchase_history
|
||||
// logging:
|
||||
// producer_destinations:
|
||||
// - monitored_resource: library.googleapis.com/branch
|
||||
// logs:
|
||||
// - library.googleapis.com/activity_history
|
||||
// - library.googleapis.com/purchase_history
|
||||
// consumer_destinations:
|
||||
// - monitored_resource: library.googleapis.com/branch
|
||||
// logs:
|
||||
// - library.googleapis.com/activity_history
|
||||
message Logging {
|
||||
// Configuration of a specific logging destination (the producer project
|
||||
// or the consumer project).
|
||||
message LoggingDestination {
|
||||
// The monitored resource type. The type must be defined in
|
||||
// [Service.monitored_resources][google.api.Service.monitored_resources] section.
|
||||
string monitored_resource = 3;
|
||||
|
||||
// Names of the logs to be sent to this destination. Each name must
|
||||
// be defined in the [Service.logs][google.api.Service.logs] section.
|
||||
repeated string logs = 1;
|
||||
}
|
||||
|
||||
// Logging configurations for sending logs to the producer project.
|
||||
// There can be multiple producer destinations, each one must have a
|
||||
// different monitored resource type. A log can be used in at most
|
||||
// one producer destination.
|
||||
repeated LoggingDestination producer_destinations = 1;
|
||||
|
||||
// Logging configurations for sending logs to the consumer project.
|
||||
// There can be multiple consumer destinations, each one must have a
|
||||
// different monitored resource type. A log can be used in at most
|
||||
// one consumer destination.
|
||||
repeated LoggingDestination consumer_destinations = 2;
|
||||
}
|
131
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/monitoring.pb.go
generated
vendored
Normal file
131
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/monitoring.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,131 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/serviceconfig/monitoring.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
|
||||
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
|
||||
|
||||
// Monitoring configuration of the service.
|
||||
//
|
||||
// The example below shows how to configure monitored resources and metrics
|
||||
// for monitoring. In the example, a monitored resource and two metrics are
|
||||
// defined. The `library.googleapis.com/book/returned_count` metric is sent
|
||||
// to both producer and consumer projects, whereas the
|
||||
// `library.googleapis.com/book/overdue_count` metric is only sent to the
|
||||
// consumer project.
|
||||
//
|
||||
// monitored_resources:
|
||||
// - type: library.googleapis.com/branch
|
||||
// labels:
|
||||
// - key: /city
|
||||
// description: The city where the library branch is located in.
|
||||
// - key: /name
|
||||
// description: The name of the branch.
|
||||
// metrics:
|
||||
// - name: library.googleapis.com/book/returned_count
|
||||
// metric_kind: DELTA
|
||||
// value_type: INT64
|
||||
// labels:
|
||||
// - key: /customer_id
|
||||
// - name: library.googleapis.com/book/overdue_count
|
||||
// metric_kind: GAUGE
|
||||
// value_type: INT64
|
||||
// labels:
|
||||
// - key: /customer_id
|
||||
// monitoring:
|
||||
// producer_destinations:
|
||||
// - monitored_resource: library.googleapis.com/branch
|
||||
// metrics:
|
||||
// - library.googleapis.com/book/returned_count
|
||||
// consumer_destinations:
|
||||
// - monitored_resource: library.googleapis.com/branch
|
||||
// metrics:
|
||||
// - library.googleapis.com/book/returned_count
|
||||
// - library.googleapis.com/book/overdue_count
|
||||
type Monitoring struct {
|
||||
// Monitoring configurations for sending metrics to the producer project.
|
||||
// There can be multiple producer destinations, each one must have a
|
||||
// different monitored resource type. A metric can be used in at most
|
||||
// one producer destination.
|
||||
ProducerDestinations []*Monitoring_MonitoringDestination `protobuf:"bytes,1,rep,name=producer_destinations,json=producerDestinations" json:"producer_destinations,omitempty"`
|
||||
// Monitoring configurations for sending metrics to the consumer project.
|
||||
// There can be multiple consumer destinations, each one must have a
|
||||
// different monitored resource type. A metric can be used in at most
|
||||
// one consumer destination.
|
||||
ConsumerDestinations []*Monitoring_MonitoringDestination `protobuf:"bytes,2,rep,name=consumer_destinations,json=consumerDestinations" json:"consumer_destinations,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Monitoring) Reset() { *m = Monitoring{} }
|
||||
func (m *Monitoring) String() string { return proto.CompactTextString(m) }
|
||||
func (*Monitoring) ProtoMessage() {}
|
||||
func (*Monitoring) Descriptor() ([]byte, []int) { return fileDescriptor12, []int{0} }
|
||||
|
||||
func (m *Monitoring) GetProducerDestinations() []*Monitoring_MonitoringDestination {
|
||||
if m != nil {
|
||||
return m.ProducerDestinations
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Monitoring) GetConsumerDestinations() []*Monitoring_MonitoringDestination {
|
||||
if m != nil {
|
||||
return m.ConsumerDestinations
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Configuration of a specific monitoring destination (the producer project
|
||||
// or the consumer project).
|
||||
type Monitoring_MonitoringDestination struct {
|
||||
// The monitored resource type. The type must be defined in
|
||||
// [Service.monitored_resources][google.api.Service.monitored_resources] section.
|
||||
MonitoredResource string `protobuf:"bytes,1,opt,name=monitored_resource,json=monitoredResource" json:"monitored_resource,omitempty"`
|
||||
// Names of the metrics to report to this monitoring destination.
|
||||
// Each name must be defined in [Service.metrics][google.api.Service.metrics] section.
|
||||
Metrics []string `protobuf:"bytes,2,rep,name=metrics" json:"metrics,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Monitoring_MonitoringDestination) Reset() { *m = Monitoring_MonitoringDestination{} }
|
||||
func (m *Monitoring_MonitoringDestination) String() string { return proto.CompactTextString(m) }
|
||||
func (*Monitoring_MonitoringDestination) ProtoMessage() {}
|
||||
func (*Monitoring_MonitoringDestination) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor12, []int{0, 0}
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Monitoring)(nil), "google.api.Monitoring")
|
||||
proto.RegisterType((*Monitoring_MonitoringDestination)(nil), "google.api.Monitoring.MonitoringDestination")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/serviceconfig/monitoring.proto", fileDescriptor12)
|
||||
}
|
||||
|
||||
var fileDescriptor12 = []byte{
|
||||
// 264 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x90, 0xd1, 0x4a, 0xc3, 0x30,
|
||||
0x14, 0x86, 0x69, 0x15, 0x65, 0x47, 0x50, 0x0c, 0x0e, 0xc6, 0xae, 0xc4, 0xab, 0x21, 0xda, 0x80,
|
||||
0x3e, 0x81, 0x43, 0xd0, 0x5d, 0x08, 0xa5, 0x2f, 0x30, 0x63, 0x7a, 0x0c, 0x81, 0x35, 0x67, 0x9c,
|
||||
0xa4, 0x3e, 0x90, 0xcf, 0xe0, 0x03, 0x9a, 0xad, 0xed, 0x5a, 0xc4, 0xab, 0xde, 0x84, 0xe4, 0x9c,
|
||||
0xff, 0xfc, 0xdf, 0x9f, 0x03, 0xaf, 0x86, 0xc8, 0x6c, 0x30, 0x33, 0xb4, 0x51, 0xce, 0x64, 0xc4,
|
||||
0x46, 0x1a, 0x74, 0x5b, 0xa6, 0x40, 0xb2, 0x69, 0xa9, 0xad, 0xf5, 0x32, 0x1e, 0xd2, 0x23, 0x7f,
|
||||
0x59, 0x8d, 0x9a, 0xdc, 0xa7, 0x35, 0xb2, 0x22, 0x67, 0x03, 0xb1, 0x8d, 0x43, 0x7b, 0xb5, 0x80,
|
||||
0xd6, 0x29, 0x4a, 0xe7, 0xab, 0xb1, 0xae, 0xca, 0x39, 0x0a, 0x2a, 0x58, 0x72, 0xbe, 0xb1, 0xbd,
|
||||
0xf9, 0x49, 0x01, 0xde, 0x0e, 0x2c, 0xa1, 0x60, 0x1a, 0xeb, 0x65, 0xad, 0x91, 0xd7, 0x25, 0xfa,
|
||||
0x60, 0x5d, 0xa3, 0x9e, 0x25, 0xd7, 0x47, 0x8b, 0xb3, 0x87, 0xbb, 0xac, 0x4f, 0x91, 0xf5, 0x63,
|
||||
0x83, 0xeb, 0x73, 0x3f, 0x54, 0x5c, 0x75, 0x56, 0x83, 0xa2, 0xdf, 0x21, 0x62, 0x1a, 0x5f, 0x57,
|
||||
0x7f, 0x11, 0xe9, 0x18, 0x44, 0x67, 0x35, 0x44, 0xcc, 0xdf, 0x61, 0xfa, 0xaf, 0x5c, 0xdc, 0x83,
|
||||
0x68, 0x17, 0x8b, 0xe5, 0x9a, 0xd1, 0x53, 0xcd, 0x1a, 0xe3, 0xdf, 0x92, 0xc5, 0xa4, 0xb8, 0x3c,
|
||||
0x74, 0x8a, 0xb6, 0x21, 0x66, 0x70, 0x5a, 0x61, 0x60, 0xab, 0x9b, 0x70, 0x93, 0xa2, 0x7b, 0x2e,
|
||||
0x6f, 0xe1, 0x5c, 0x53, 0x35, 0x88, 0xba, 0xbc, 0xe8, 0x89, 0xf9, 0x6e, 0xb3, 0x79, 0xf2, 0x9d,
|
||||
0x1e, 0xbf, 0x3c, 0xe5, 0xab, 0x8f, 0x93, 0xfd, 0xa6, 0x1f, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff,
|
||||
0x1a, 0x02, 0x76, 0xbb, 0x0c, 0x02, 0x00, 0x00,
|
||||
}
|
88
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/monitoring.proto
generated
vendored
Normal file
88
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/monitoring.proto
generated
vendored
Normal file
|
@ -0,0 +1,88 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto"; // from google/api/annotations.proto
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "MonitoringProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
|
||||
// Monitoring configuration of the service.
|
||||
//
|
||||
// The example below shows how to configure monitored resources and metrics
|
||||
// for monitoring. In the example, a monitored resource and two metrics are
|
||||
// defined. The `library.googleapis.com/book/returned_count` metric is sent
|
||||
// to both producer and consumer projects, whereas the
|
||||
// `library.googleapis.com/book/overdue_count` metric is only sent to the
|
||||
// consumer project.
|
||||
//
|
||||
// monitored_resources:
|
||||
// - type: library.googleapis.com/branch
|
||||
// labels:
|
||||
// - key: /city
|
||||
// description: The city where the library branch is located in.
|
||||
// - key: /name
|
||||
// description: The name of the branch.
|
||||
// metrics:
|
||||
// - name: library.googleapis.com/book/returned_count
|
||||
// metric_kind: DELTA
|
||||
// value_type: INT64
|
||||
// labels:
|
||||
// - key: /customer_id
|
||||
// - name: library.googleapis.com/book/overdue_count
|
||||
// metric_kind: GAUGE
|
||||
// value_type: INT64
|
||||
// labels:
|
||||
// - key: /customer_id
|
||||
// monitoring:
|
||||
// producer_destinations:
|
||||
// - monitored_resource: library.googleapis.com/branch
|
||||
// metrics:
|
||||
// - library.googleapis.com/book/returned_count
|
||||
// consumer_destinations:
|
||||
// - monitored_resource: library.googleapis.com/branch
|
||||
// metrics:
|
||||
// - library.googleapis.com/book/returned_count
|
||||
// - library.googleapis.com/book/overdue_count
|
||||
message Monitoring {
|
||||
// Configuration of a specific monitoring destination (the producer project
|
||||
// or the consumer project).
|
||||
message MonitoringDestination {
|
||||
// The monitored resource type. The type must be defined in
|
||||
// [Service.monitored_resources][google.api.Service.monitored_resources] section.
|
||||
string monitored_resource = 1;
|
||||
|
||||
// Names of the metrics to report to this monitoring destination.
|
||||
// Each name must be defined in [Service.metrics][google.api.Service.metrics] section.
|
||||
repeated string metrics = 2;
|
||||
}
|
||||
|
||||
// Monitoring configurations for sending metrics to the producer project.
|
||||
// There can be multiple producer destinations, each one must have a
|
||||
// different monitored resource type. A metric can be used in at most
|
||||
// one producer destination.
|
||||
repeated MonitoringDestination producer_destinations = 1;
|
||||
|
||||
// Monitoring configurations for sending metrics to the consumer project.
|
||||
// There can be multiple consumer destinations, each one must have a
|
||||
// different monitored resource type. A metric can be used in at most
|
||||
// one consumer destination.
|
||||
repeated MonitoringDestination consumer_destinations = 2;
|
||||
}
|
305
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/service.pb.go
generated
vendored
Normal file
305
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/service.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,305 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/serviceconfig/service.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "google.golang.org/genproto/googleapis/api/label"
|
||||
import google_api2 "google.golang.org/genproto/googleapis/api/metric"
|
||||
import google_api3 "google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
import _ "github.com/golang/protobuf/ptypes/any"
|
||||
import google_protobuf4 "google.golang.org/genproto/protobuf"
|
||||
import google_protobuf3 "google.golang.org/genproto/protobuf"
|
||||
import google_protobuf5 "github.com/golang/protobuf/ptypes/wrappers"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// `Service` is the root object of the configuration schema. It
|
||||
// describes basic information like the name of the service and the
|
||||
// exposed API interfaces, and delegates other aspects to configuration
|
||||
// sub-sections.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// type: google.api.Service
|
||||
// config_version: 1
|
||||
// name: calendar.googleapis.com
|
||||
// title: Google Calendar API
|
||||
// apis:
|
||||
// - name: google.calendar.Calendar
|
||||
// backend:
|
||||
// rules:
|
||||
// - selector: "*"
|
||||
// address: calendar.example.com
|
||||
type Service struct {
|
||||
// The version of the service configuration. The config version may
|
||||
// influence interpretation of the configuration, for example, to
|
||||
// determine defaults. This is documented together with applicable
|
||||
// options. The current default for the config version itself is `3`.
|
||||
ConfigVersion *google_protobuf5.UInt32Value `protobuf:"bytes,20,opt,name=config_version,json=configVersion" json:"config_version,omitempty"`
|
||||
// The DNS address at which this service is available,
|
||||
// e.g. `calendar.googleapis.com`.
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// A unique ID for a specific instance of this message, typically assigned
|
||||
// by the client for tracking purpose. If empty, the server may choose to
|
||||
// generate one instead.
|
||||
Id string `protobuf:"bytes,33,opt,name=id" json:"id,omitempty"`
|
||||
// The product title associated with this service.
|
||||
Title string `protobuf:"bytes,2,opt,name=title" json:"title,omitempty"`
|
||||
// The id of the Google developer project that owns the service.
|
||||
// Members of this project can manage the service configuration,
|
||||
// manage consumption of the service, etc.
|
||||
ProducerProjectId string `protobuf:"bytes,22,opt,name=producer_project_id,json=producerProjectId" json:"producer_project_id,omitempty"`
|
||||
// A list of API interfaces exported by this service. Only the `name` field
|
||||
// of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by the configuration
|
||||
// author, as the remaining fields will be derived from the IDL during the
|
||||
// normalization process. It is an error to specify an API interface here
|
||||
// which cannot be resolved against the associated IDL files.
|
||||
Apis []*google_protobuf4.Api `protobuf:"bytes,3,rep,name=apis" json:"apis,omitempty"`
|
||||
// A list of all proto message types included in this API service.
|
||||
// Types referenced directly or indirectly by the `apis` are
|
||||
// automatically included. Messages which are not referenced but
|
||||
// shall be included, such as types used by the `google.protobuf.Any` type,
|
||||
// should be listed here by name. Example:
|
||||
//
|
||||
// types:
|
||||
// - name: google.protobuf.Int32
|
||||
Types []*google_protobuf3.Type `protobuf:"bytes,4,rep,name=types" json:"types,omitempty"`
|
||||
// A list of all enum types included in this API service. Enums
|
||||
// referenced directly or indirectly by the `apis` are automatically
|
||||
// included. Enums which are not referenced but shall be included
|
||||
// should be listed here by name. Example:
|
||||
//
|
||||
// enums:
|
||||
// - name: google.someapi.v1.SomeEnum
|
||||
Enums []*google_protobuf3.Enum `protobuf:"bytes,5,rep,name=enums" json:"enums,omitempty"`
|
||||
// Additional API documentation.
|
||||
Documentation *Documentation `protobuf:"bytes,6,opt,name=documentation" json:"documentation,omitempty"`
|
||||
// API backend configuration.
|
||||
Backend *Backend `protobuf:"bytes,8,opt,name=backend" json:"backend,omitempty"`
|
||||
// HTTP configuration.
|
||||
Http *Http `protobuf:"bytes,9,opt,name=http" json:"http,omitempty"`
|
||||
// Auth configuration.
|
||||
Authentication *Authentication `protobuf:"bytes,11,opt,name=authentication" json:"authentication,omitempty"`
|
||||
// Context configuration.
|
||||
Context *Context `protobuf:"bytes,12,opt,name=context" json:"context,omitempty"`
|
||||
// Configuration controlling usage of this service.
|
||||
Usage *Usage `protobuf:"bytes,15,opt,name=usage" json:"usage,omitempty"`
|
||||
// Configuration for network endpoints. If this is empty, then an endpoint
|
||||
// with the same name as the service is automatically generated to service all
|
||||
// defined APIs.
|
||||
Endpoints []*Endpoint `protobuf:"bytes,18,rep,name=endpoints" json:"endpoints,omitempty"`
|
||||
// Configuration for the service control plane.
|
||||
Control *Control `protobuf:"bytes,21,opt,name=control" json:"control,omitempty"`
|
||||
// Defines the logs used by this service.
|
||||
Logs []*LogDescriptor `protobuf:"bytes,23,rep,name=logs" json:"logs,omitempty"`
|
||||
// Defines the metrics used by this service.
|
||||
Metrics []*google_api2.MetricDescriptor `protobuf:"bytes,24,rep,name=metrics" json:"metrics,omitempty"`
|
||||
// Defines the monitored resources used by this service. This is required
|
||||
// by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations.
|
||||
MonitoredResources []*google_api3.MonitoredResourceDescriptor `protobuf:"bytes,25,rep,name=monitored_resources,json=monitoredResources" json:"monitored_resources,omitempty"`
|
||||
// Logging configuration of the service.
|
||||
Logging *Logging `protobuf:"bytes,27,opt,name=logging" json:"logging,omitempty"`
|
||||
// Monitoring configuration of the service.
|
||||
Monitoring *Monitoring `protobuf:"bytes,28,opt,name=monitoring" json:"monitoring,omitempty"`
|
||||
// Configuration for system parameters.
|
||||
SystemParameters *SystemParameters `protobuf:"bytes,29,opt,name=system_parameters,json=systemParameters" json:"system_parameters,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Service) Reset() { *m = Service{} }
|
||||
func (m *Service) String() string { return proto.CompactTextString(m) }
|
||||
func (*Service) ProtoMessage() {}
|
||||
func (*Service) Descriptor() ([]byte, []int) { return fileDescriptor13, []int{0} }
|
||||
|
||||
func (m *Service) GetConfigVersion() *google_protobuf5.UInt32Value {
|
||||
if m != nil {
|
||||
return m.ConfigVersion
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Service) GetApis() []*google_protobuf4.Api {
|
||||
if m != nil {
|
||||
return m.Apis
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Service) GetTypes() []*google_protobuf3.Type {
|
||||
if m != nil {
|
||||
return m.Types
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Service) GetEnums() []*google_protobuf3.Enum {
|
||||
if m != nil {
|
||||
return m.Enums
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Service) GetDocumentation() *Documentation {
|
||||
if m != nil {
|
||||
return m.Documentation
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Service) GetBackend() *Backend {
|
||||
if m != nil {
|
||||
return m.Backend
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Service) GetHttp() *Http {
|
||||
if m != nil {
|
||||
return m.Http
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Service) GetAuthentication() *Authentication {
|
||||
if m != nil {
|
||||
return m.Authentication
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Service) GetContext() *Context {
|
||||
if m != nil {
|
||||
return m.Context
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Service) GetUsage() *Usage {
|
||||
if m != nil {
|
||||
return m.Usage
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Service) GetEndpoints() []*Endpoint {
|
||||
if m != nil {
|
||||
return m.Endpoints
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Service) GetControl() *Control {
|
||||
if m != nil {
|
||||
return m.Control
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Service) GetLogs() []*LogDescriptor {
|
||||
if m != nil {
|
||||
return m.Logs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Service) GetMetrics() []*google_api2.MetricDescriptor {
|
||||
if m != nil {
|
||||
return m.Metrics
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Service) GetMonitoredResources() []*google_api3.MonitoredResourceDescriptor {
|
||||
if m != nil {
|
||||
return m.MonitoredResources
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Service) GetLogging() *Logging {
|
||||
if m != nil {
|
||||
return m.Logging
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Service) GetMonitoring() *Monitoring {
|
||||
if m != nil {
|
||||
return m.Monitoring
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Service) GetSystemParameters() *SystemParameters {
|
||||
if m != nil {
|
||||
return m.SystemParameters
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Service)(nil), "google.api.Service")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/serviceconfig/service.proto", fileDescriptor13)
|
||||
}
|
||||
|
||||
var fileDescriptor13 = []byte{
|
||||
// 772 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x95, 0x6b, 0x4f, 0xd4, 0x4c,
|
||||
0x14, 0xc7, 0x03, 0x2c, 0xb7, 0xe1, 0xf2, 0xc0, 0x70, 0x79, 0x86, 0x15, 0x13, 0x34, 0x26, 0x90,
|
||||
0x18, 0xda, 0x04, 0x12, 0x13, 0x63, 0x8c, 0xd9, 0x05, 0x94, 0x8d, 0xa8, 0x9b, 0x41, 0x88, 0xef,
|
||||
0x36, 0xdd, 0xee, 0x50, 0xaa, 0xdd, 0x99, 0xa6, 0x9d, 0xa2, 0x7c, 0x1d, 0x3f, 0x8b, 0x1f, 0xcc,
|
||||
0xd3, 0xb9, 0xb0, 0xed, 0x2e, 0x2a, 0x16, 0x5f, 0xec, 0xb6, 0x9d, 0xf3, 0xfb, 0xff, 0xe7, 0x9c,
|
||||
0x99, 0xcc, 0x19, 0x74, 0x14, 0x08, 0x11, 0x44, 0xcc, 0x09, 0x44, 0xe4, 0xf1, 0xc0, 0x11, 0x49,
|
||||
0xe0, 0x06, 0x8c, 0xc7, 0x89, 0x90, 0xc2, 0xd5, 0x21, 0x2f, 0x0e, 0x53, 0x17, 0xfe, 0xdc, 0x94,
|
||||
0x25, 0x57, 0xa1, 0xcf, 0x7c, 0xc1, 0x2f, 0xc2, 0xc0, 0x7e, 0x39, 0x0a, 0xc5, 0xc8, 0xd8, 0x00,
|
||||
0x57, 0x6f, 0x55, 0xb5, 0xf4, 0x38, 0x17, 0xd2, 0x93, 0xa1, 0xe0, 0xa9, 0xb6, 0xad, 0x37, 0x2b,
|
||||
0x5b, 0x65, 0xf2, 0xd2, 0x78, 0x54, 0xae, 0xb0, 0xeb, 0xf9, 0x5f, 0x18, 0xef, 0xdd, 0xd7, 0x06,
|
||||
0x1e, 0x92, 0x7d, 0x93, 0xff, 0xc2, 0x26, 0x11, 0x91, 0xb1, 0x79, 0x5b, 0xd5, 0xa6, 0x27, 0xfc,
|
||||
0xac, 0xcf, 0xb8, 0x5e, 0x66, 0x63, 0xf6, 0xba, 0xaa, 0x19, 0xac, 0x4e, 0x2c, 0x42, 0x2e, 0xef,
|
||||
0xbb, 0x5b, 0x97, 0x52, 0xc6, 0xc6, 0xe3, 0xc5, 0xdd, 0x3d, 0x22, 0xaf, 0xcb, 0x22, 0xfd, 0x6f,
|
||||
0xc4, 0x8d, 0xaa, 0x09, 0x44, 0x22, 0xb8, 0xef, 0xfe, 0x80, 0x45, 0x10, 0x72, 0x6b, 0xf3, 0xf2,
|
||||
0xee, 0x36, 0x7d, 0x26, 0x93, 0xd0, 0x37, 0x0f, 0x23, 0xff, 0xf0, 0x17, 0x72, 0xc1, 0x43, 0x29,
|
||||
0x12, 0xd6, 0x4b, 0x58, 0x3a, 0xf8, 0xe8, 0xc0, 0x97, 0xc8, 0x12, 0x7b, 0x3e, 0xeb, 0xc7, 0x55,
|
||||
0xcb, 0x32, 0x8e, 0x83, 0xca, 0xde, 0x57, 0x6e, 0x18, 0xd7, 0xa9, 0x64, 0xfd, 0x4e, 0xec, 0x25,
|
||||
0x1e, 0xd4, 0xca, 0x12, 0xe3, 0x77, 0x50, 0xd5, 0x2f, 0x4b, 0xbd, 0xc0, 0x96, 0xe7, 0x06, 0xa1,
|
||||
0xbc, 0xcc, 0xba, 0x8e, 0x2f, 0xfa, 0xae, 0x36, 0x72, 0x55, 0xa0, 0x9b, 0x5d, 0xb8, 0xb1, 0xbc,
|
||||
0x8e, 0x61, 0x69, 0x3c, 0x7e, 0x9d, 0xff, 0x8c, 0x60, 0xf7, 0x37, 0xb3, 0xde, 0x28, 0x61, 0x4e,
|
||||
0x83, 0x3b, 0x77, 0xc1, 0xf3, 0x79, 0x0c, 0xff, 0xfc, 0xcf, 0xf9, 0x7c, 0x4d, 0xbc, 0x38, 0x66,
|
||||
0xc9, 0xe0, 0x45, 0x4b, 0x1f, 0xff, 0x98, 0x41, 0xd3, 0xa7, 0xba, 0x50, 0x7c, 0x80, 0x16, 0x75,
|
||||
0xb1, 0x9d, 0x2b, 0x00, 0xe0, 0xc0, 0x92, 0xd5, 0xad, 0xb1, 0x9d, 0xb9, 0xbd, 0x4d, 0x9b, 0x8f,
|
||||
0x35, 0x75, 0xce, 0x5a, 0x5c, 0xee, 0xef, 0x9d, 0x7b, 0x51, 0xc6, 0xe8, 0x82, 0xd6, 0x9c, 0x6b,
|
||||
0x09, 0xc6, 0xa8, 0xc6, 0x61, 0xc5, 0xc9, 0x18, 0x48, 0x67, 0xa9, 0x7a, 0xc7, 0x8b, 0x68, 0x3c,
|
||||
0xec, 0x91, 0x47, 0x6a, 0x04, 0xde, 0xf0, 0x2a, 0x9a, 0x94, 0xa1, 0x8c, 0x18, 0x19, 0x57, 0x43,
|
||||
0xfa, 0x03, 0x3b, 0x68, 0x05, 0x26, 0xe8, 0x65, 0x3e, 0x4b, 0x3a, 0xf0, 0xf2, 0x99, 0xf9, 0xb2,
|
||||
0x03, 0xb2, 0x75, 0xc5, 0x2c, 0xdb, 0x50, 0x5b, 0x47, 0x5a, 0x3d, 0xbc, 0x83, 0x6a, 0xf9, 0x5e,
|
||||
0x91, 0x89, 0xad, 0x09, 0x48, 0x72, 0x75, 0x24, 0xc9, 0x46, 0x1c, 0x52, 0x45, 0xe0, 0xa7, 0x30,
|
||||
0x5f, 0xbe, 0x0a, 0xa4, 0xa6, 0xd0, 0xb5, 0x11, 0xf4, 0x23, 0x44, 0xa9, 0x66, 0x72, 0x98, 0xf1,
|
||||
0xac, 0x9f, 0x92, 0xc9, 0x5f, 0xc0, 0x47, 0x10, 0xa5, 0x9a, 0xc1, 0xaf, 0xd0, 0x42, 0xa9, 0xc5,
|
||||
0x91, 0x29, 0xb5, 0x62, 0x1b, 0xce, 0xe0, 0x82, 0x72, 0x0e, 0x8b, 0x00, 0x2d, 0xf3, 0x78, 0x17,
|
||||
0x4d, 0x9b, 0xc6, 0x4f, 0x66, 0x94, 0x74, 0xa5, 0x28, 0x6d, 0xea, 0x10, 0xb5, 0x0c, 0x7e, 0x82,
|
||||
0x6a, 0x79, 0xf7, 0x22, 0xb3, 0x8a, 0x5d, 0x2a, 0xb2, 0xc7, 0x30, 0x4e, 0x55, 0x14, 0x37, 0xd1,
|
||||
0x62, 0x7e, 0x23, 0xc1, 0x24, 0xa1, 0xaf, 0xd3, 0x9a, 0x53, 0x7c, 0xbd, 0xc8, 0x37, 0x4a, 0x04,
|
||||
0x1d, 0x52, 0xe4, 0x89, 0x99, 0xab, 0x84, 0xcc, 0x8f, 0x26, 0x76, 0xa0, 0x43, 0xd4, 0x32, 0x78,
|
||||
0x1b, 0x4d, 0xaa, 0x13, 0x42, 0xfe, 0x53, 0xf0, 0x72, 0x11, 0x3e, 0xcb, 0x03, 0x54, 0xc7, 0xf1,
|
||||
0x1e, 0x9a, 0xb5, 0x7d, 0x3c, 0x25, 0xb8, 0xbc, 0x75, 0x39, 0x7c, 0x64, 0x82, 0x74, 0x80, 0xd9,
|
||||
0x5c, 0xe0, 0x3e, 0x22, 0x6b, 0xb7, 0xe7, 0x02, 0x21, 0x6a, 0x19, 0xc0, 0x6b, 0xd0, 0x1e, 0x53,
|
||||
0xf2, 0xbf, 0x72, 0x2f, 0xed, 0xc5, 0x89, 0x08, 0x0e, 0x59, 0xea, 0x27, 0x61, 0x0c, 0x5d, 0x86,
|
||||
0x2a, 0x0c, 0x3f, 0x43, 0xd3, 0xba, 0x1b, 0xa6, 0x84, 0x28, 0xc5, 0x66, 0x51, 0xf1, 0x4e, 0x85,
|
||||
0x0a, 0x22, 0x0b, 0xe3, 0x4f, 0x68, 0x65, 0xb4, 0x01, 0xa6, 0x64, 0x43, 0x79, 0x6c, 0x97, 0x3c,
|
||||
0x2c, 0x46, 0x0d, 0x55, 0xb0, 0xc3, 0xfd, 0xe1, 0xa0, 0xaa, 0xd7, 0xf4, 0x77, 0xf2, 0x60, 0xb4,
|
||||
0xde, 0x13, 0x1d, 0xa2, 0x96, 0x81, 0x02, 0xd0, 0xa0, 0x6f, 0x92, 0x4d, 0xa5, 0x58, 0xbf, 0x65,
|
||||
0xfe, 0x5c, 0x54, 0x20, 0x71, 0x0b, 0x2d, 0x0f, 0x77, 0xc9, 0x94, 0x3c, 0x2c, 0x1f, 0xf9, 0x5c,
|
||||
0x7e, 0xaa, 0xa0, 0xf6, 0x0d, 0x43, 0x97, 0xd2, 0xa1, 0x91, 0xe6, 0x76, 0xde, 0x3a, 0xfa, 0x05,
|
||||
0x51, 0x73, 0xde, 0x74, 0x95, 0x76, 0x7e, 0x6c, 0xda, 0x63, 0xdf, 0xc7, 0x6b, 0x6f, 0x1a, 0xed,
|
||||
0x56, 0x77, 0x4a, 0x1d, 0xa3, 0xfd, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xfc, 0x22, 0x08, 0x2f,
|
||||
0x09, 0x0a, 0x00, 0x00,
|
||||
}
|
157
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/service.proto
generated
vendored
Normal file
157
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/service.proto
generated
vendored
Normal file
|
@ -0,0 +1,157 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto"; // from google/api/annotations.proto
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/auth.proto"; // from google/api/auth.proto
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/backend.proto"; // from google/api/backend.proto
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/context.proto"; // from google/api/context.proto
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/control.proto"; // from google/api/control.proto
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/documentation.proto"; // from google/api/documentation.proto
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/endpoint.proto"; // from google/api/endpoint.proto
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/http.proto"; // from google/api/http.proto
|
||||
import "google.golang.org/genproto/googleapis/api/label/label.proto"; // from google/api/label.proto
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/log.proto"; // from google/api/log.proto
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/logging.proto"; // from google/api/logging.proto
|
||||
import "google.golang.org/genproto/googleapis/api/metric/metric.proto"; // from google/api/metric.proto
|
||||
import "google.golang.org/genproto/googleapis/api/monitoredres/monitored_resource.proto"; // from google/api/monitored_resource.proto
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/monitoring.proto"; // from google/api/monitoring.proto
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/system_parameter.proto"; // from google/api/system_parameter.proto
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/usage.proto"; // from google/api/usage.proto
|
||||
import "github.com/golang/protobuf/ptypes/any/any.proto"; // from google/protobuf/any.proto
|
||||
import "google.golang.org/genproto/protobuf/api.proto"; // from google/protobuf/api.proto
|
||||
import "google.golang.org/genproto/protobuf/type.proto"; // from google/protobuf/type.proto
|
||||
import "github.com/golang/protobuf/ptypes/wrappers/wrappers.proto"; // from google/protobuf/wrappers.proto
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "ServiceProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
|
||||
// `Service` is the root object of the configuration schema. It
|
||||
// describes basic information like the name of the service and the
|
||||
// exposed API interfaces, and delegates other aspects to configuration
|
||||
// sub-sections.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// type: google.api.Service
|
||||
// config_version: 1
|
||||
// name: calendar.googleapis.com
|
||||
// title: Google Calendar API
|
||||
// apis:
|
||||
// - name: google.calendar.Calendar
|
||||
// backend:
|
||||
// rules:
|
||||
// - selector: "*"
|
||||
// address: calendar.example.com
|
||||
message Service {
|
||||
// The version of the service configuration. The config version may
|
||||
// influence interpretation of the configuration, for example, to
|
||||
// determine defaults. This is documented together with applicable
|
||||
// options. The current default for the config version itself is `3`.
|
||||
google.protobuf.UInt32Value config_version = 20;
|
||||
|
||||
// The DNS address at which this service is available,
|
||||
// e.g. `calendar.googleapis.com`.
|
||||
string name = 1;
|
||||
|
||||
// A unique ID for a specific instance of this message, typically assigned
|
||||
// by the client for tracking purpose. If empty, the server may choose to
|
||||
// generate one instead.
|
||||
string id = 33;
|
||||
|
||||
// The product title associated with this service.
|
||||
string title = 2;
|
||||
|
||||
// The id of the Google developer project that owns the service.
|
||||
// Members of this project can manage the service configuration,
|
||||
// manage consumption of the service, etc.
|
||||
string producer_project_id = 22;
|
||||
|
||||
// A list of API interfaces exported by this service. Only the `name` field
|
||||
// of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by the configuration
|
||||
// author, as the remaining fields will be derived from the IDL during the
|
||||
// normalization process. It is an error to specify an API interface here
|
||||
// which cannot be resolved against the associated IDL files.
|
||||
repeated google.protobuf.Api apis = 3;
|
||||
|
||||
// A list of all proto message types included in this API service.
|
||||
// Types referenced directly or indirectly by the `apis` are
|
||||
// automatically included. Messages which are not referenced but
|
||||
// shall be included, such as types used by the `google.protobuf.Any` type,
|
||||
// should be listed here by name. Example:
|
||||
//
|
||||
// types:
|
||||
// - name: google.protobuf.Int32
|
||||
repeated google.protobuf.Type types = 4;
|
||||
|
||||
// A list of all enum types included in this API service. Enums
|
||||
// referenced directly or indirectly by the `apis` are automatically
|
||||
// included. Enums which are not referenced but shall be included
|
||||
// should be listed here by name. Example:
|
||||
//
|
||||
// enums:
|
||||
// - name: google.someapi.v1.SomeEnum
|
||||
repeated google.protobuf.Enum enums = 5;
|
||||
|
||||
// Additional API documentation.
|
||||
Documentation documentation = 6;
|
||||
|
||||
// API backend configuration.
|
||||
Backend backend = 8;
|
||||
|
||||
// HTTP configuration.
|
||||
Http http = 9;
|
||||
|
||||
// Auth configuration.
|
||||
Authentication authentication = 11;
|
||||
|
||||
// Context configuration.
|
||||
Context context = 12;
|
||||
|
||||
// Configuration controlling usage of this service.
|
||||
Usage usage = 15;
|
||||
|
||||
// Configuration for network endpoints. If this is empty, then an endpoint
|
||||
// with the same name as the service is automatically generated to service all
|
||||
// defined APIs.
|
||||
repeated Endpoint endpoints = 18;
|
||||
|
||||
// Configuration for the service control plane.
|
||||
Control control = 21;
|
||||
|
||||
// Defines the logs used by this service.
|
||||
repeated LogDescriptor logs = 23;
|
||||
|
||||
// Defines the metrics used by this service.
|
||||
repeated MetricDescriptor metrics = 24;
|
||||
|
||||
// Defines the monitored resources used by this service. This is required
|
||||
// by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations.
|
||||
repeated MonitoredResourceDescriptor monitored_resources = 25;
|
||||
|
||||
// Logging configuration of the service.
|
||||
Logging logging = 27;
|
||||
|
||||
// Monitoring configuration of the service.
|
||||
Monitoring monitoring = 28;
|
||||
|
||||
// Configuration for system parameters.
|
||||
SystemParameters system_parameters = 29;
|
||||
}
|
146
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/system_parameter.pb.go
generated
vendored
Normal file
146
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/system_parameter.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,146 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/serviceconfig/system_parameter.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
|
||||
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
|
||||
|
||||
// ### System parameter configuration
|
||||
//
|
||||
// A system parameter is a special kind of parameter defined by the API
|
||||
// system, not by an individual API. It is typically mapped to an HTTP header
|
||||
// and/or a URL query parameter. This configuration specifies which methods
|
||||
// change the names of the system parameters.
|
||||
type SystemParameters struct {
|
||||
// Define system parameters.
|
||||
//
|
||||
// The parameters defined here will override the default parameters
|
||||
// implemented by the system. If this field is missing from the service
|
||||
// config, default system parameters will be used. Default system parameters
|
||||
// and names is implementation-dependent.
|
||||
//
|
||||
// Example: define api key and alt name for all methods
|
||||
//
|
||||
// system_parameters
|
||||
// rules:
|
||||
// - selector: "*"
|
||||
// parameters:
|
||||
// - name: api_key
|
||||
// url_query_parameter: api_key
|
||||
// - name: alt
|
||||
// http_header: Response-Content-Type
|
||||
//
|
||||
// Example: define 2 api key names for a specific method.
|
||||
//
|
||||
// system_parameters
|
||||
// rules:
|
||||
// - selector: "/ListShelves"
|
||||
// parameters:
|
||||
// - name: api_key
|
||||
// http_header: Api-Key1
|
||||
// - name: api_key
|
||||
// http_header: Api-Key2
|
||||
//
|
||||
// **NOTE:** All service configuration rules follow "last one wins" order.
|
||||
Rules []*SystemParameterRule `protobuf:"bytes,1,rep,name=rules" json:"rules,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SystemParameters) Reset() { *m = SystemParameters{} }
|
||||
func (m *SystemParameters) String() string { return proto.CompactTextString(m) }
|
||||
func (*SystemParameters) ProtoMessage() {}
|
||||
func (*SystemParameters) Descriptor() ([]byte, []int) { return fileDescriptor14, []int{0} }
|
||||
|
||||
func (m *SystemParameters) GetRules() []*SystemParameterRule {
|
||||
if m != nil {
|
||||
return m.Rules
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Define a system parameter rule mapping system parameter definitions to
|
||||
// methods.
|
||||
type SystemParameterRule struct {
|
||||
// Selects the methods to which this rule applies. Use '*' to indicate all
|
||||
// methods in all APIs.
|
||||
//
|
||||
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
||||
Selector string `protobuf:"bytes,1,opt,name=selector" json:"selector,omitempty"`
|
||||
// Define parameters. Multiple names may be defined for a parameter.
|
||||
// For a given method call, only one of them should be used. If multiple
|
||||
// names are used the behavior is implementation-dependent.
|
||||
// If none of the specified names are present the behavior is
|
||||
// parameter-dependent.
|
||||
Parameters []*SystemParameter `protobuf:"bytes,2,rep,name=parameters" json:"parameters,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SystemParameterRule) Reset() { *m = SystemParameterRule{} }
|
||||
func (m *SystemParameterRule) String() string { return proto.CompactTextString(m) }
|
||||
func (*SystemParameterRule) ProtoMessage() {}
|
||||
func (*SystemParameterRule) Descriptor() ([]byte, []int) { return fileDescriptor14, []int{1} }
|
||||
|
||||
func (m *SystemParameterRule) GetParameters() []*SystemParameter {
|
||||
if m != nil {
|
||||
return m.Parameters
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Define a parameter's name and location. The parameter may be passed as either
|
||||
// an HTTP header or a URL query parameter, and if both are passed the behavior
|
||||
// is implementation-dependent.
|
||||
type SystemParameter struct {
|
||||
// Define the name of the parameter, such as "api_key", "alt", "callback",
|
||||
// and etc. It is case sensitive.
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// Define the HTTP header name to use for the parameter. It is case
|
||||
// insensitive.
|
||||
HttpHeader string `protobuf:"bytes,2,opt,name=http_header,json=httpHeader" json:"http_header,omitempty"`
|
||||
// Define the URL query parameter name to use for the parameter. It is case
|
||||
// sensitive.
|
||||
UrlQueryParameter string `protobuf:"bytes,3,opt,name=url_query_parameter,json=urlQueryParameter" json:"url_query_parameter,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SystemParameter) Reset() { *m = SystemParameter{} }
|
||||
func (m *SystemParameter) String() string { return proto.CompactTextString(m) }
|
||||
func (*SystemParameter) ProtoMessage() {}
|
||||
func (*SystemParameter) Descriptor() ([]byte, []int) { return fileDescriptor14, []int{2} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*SystemParameters)(nil), "google.api.SystemParameters")
|
||||
proto.RegisterType((*SystemParameterRule)(nil), "google.api.SystemParameterRule")
|
||||
proto.RegisterType((*SystemParameter)(nil), "google.api.SystemParameter")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/serviceconfig/system_parameter.proto", fileDescriptor14)
|
||||
}
|
||||
|
||||
var fileDescriptor14 = []byte{
|
||||
// 277 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x90, 0xbf, 0x4e, 0xc3, 0x30,
|
||||
0x10, 0xc6, 0x95, 0xb6, 0x20, 0xb8, 0x4a, 0xfc, 0x71, 0x19, 0x22, 0x18, 0x8a, 0x32, 0x75, 0xb2,
|
||||
0x25, 0x10, 0x13, 0x13, 0x5d, 0xa0, 0x0b, 0x0a, 0xe1, 0x01, 0xa2, 0x10, 0x0e, 0x37, 0x52, 0x62,
|
||||
0x87, 0xb3, 0x53, 0xa9, 0xaf, 0xc3, 0x93, 0xe2, 0xb8, 0x25, 0xad, 0x22, 0xd4, 0xc5, 0x3a, 0xdf,
|
||||
0xf7, 0xbb, 0xfb, 0x4e, 0x1f, 0xbc, 0x4a, 0xad, 0x65, 0x89, 0x5c, 0xea, 0x32, 0x53, 0x92, 0x6b,
|
||||
0x92, 0x42, 0xa2, 0xaa, 0x49, 0x5b, 0x2d, 0x36, 0x52, 0x56, 0x17, 0x46, 0xb8, 0x47, 0x18, 0xa4,
|
||||
0x55, 0x91, 0x63, 0xae, 0xd5, 0x57, 0x21, 0x85, 0x59, 0x1b, 0x8b, 0x55, 0x5a, 0x67, 0x94, 0x55,
|
||||
0x68, 0x91, 0xb8, 0x9f, 0x61, 0xb0, 0xdd, 0xe7, 0x06, 0xa2, 0x05, 0x5c, 0xbc, 0x7b, 0x2a, 0xfe,
|
||||
0x83, 0x0c, 0x7b, 0x80, 0x23, 0x6a, 0x4a, 0x34, 0x61, 0x70, 0x3b, 0x9c, 0x8d, 0xef, 0xa6, 0x7c,
|
||||
0xc7, 0xf3, 0x1e, 0x9c, 0x38, 0x2e, 0xd9, 0xd0, 0x91, 0x82, 0xc9, 0x3f, 0x2a, 0xbb, 0x86, 0x13,
|
||||
0x83, 0x25, 0xe6, 0x56, 0x93, 0x5b, 0x18, 0xcc, 0x4e, 0x93, 0xee, 0xcf, 0x1e, 0x01, 0xba, 0xe3,
|
||||
0x4c, 0x38, 0xf0, 0x76, 0x37, 0x87, 0xec, 0xf6, 0xf0, 0x68, 0x05, 0xe7, 0x3d, 0x99, 0x31, 0x18,
|
||||
0x29, 0x57, 0x6e, 0x7d, 0x7c, 0xcd, 0xa6, 0x30, 0x5e, 0x5a, 0x5b, 0xa7, 0x4b, 0xcc, 0x3e, 0x91,
|
||||
0x9c, 0x49, 0x2b, 0x41, 0xdb, 0x7a, 0xf1, 0x1d, 0xc6, 0x61, 0xd2, 0x50, 0x99, 0x7e, 0x37, 0x48,
|
||||
0xeb, 0x5d, 0x56, 0xe1, 0xd0, 0x83, 0x97, 0x4e, 0x7a, 0x6b, 0x95, 0xce, 0x64, 0x2e, 0xe0, 0x2c,
|
||||
0xd7, 0xd5, 0xde, 0x95, 0xf3, 0xab, 0xde, 0x1d, 0x71, 0x1b, 0x73, 0x1c, 0xfc, 0x0c, 0x46, 0xcf,
|
||||
0x4f, 0xf1, 0xe2, 0xe3, 0xd8, 0xc7, 0x7e, 0xff, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x56, 0xd1, 0x77,
|
||||
0xac, 0xc8, 0x01, 0x00, 0x00,
|
||||
}
|
97
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/system_parameter.proto
generated
vendored
Normal file
97
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/system_parameter.proto
generated
vendored
Normal file
|
@ -0,0 +1,97 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "SystemParameterProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
|
||||
// ### System parameter configuration
|
||||
//
|
||||
// A system parameter is a special kind of parameter defined by the API
|
||||
// system, not by an individual API. It is typically mapped to an HTTP header
|
||||
// and/or a URL query parameter. This configuration specifies which methods
|
||||
// change the names of the system parameters.
|
||||
message SystemParameters {
|
||||
// Define system parameters.
|
||||
//
|
||||
// The parameters defined here will override the default parameters
|
||||
// implemented by the system. If this field is missing from the service
|
||||
// config, default system parameters will be used. Default system parameters
|
||||
// and names is implementation-dependent.
|
||||
//
|
||||
// Example: define api key and alt name for all methods
|
||||
//
|
||||
// system_parameters
|
||||
// rules:
|
||||
// - selector: "*"
|
||||
// parameters:
|
||||
// - name: api_key
|
||||
// url_query_parameter: api_key
|
||||
// - name: alt
|
||||
// http_header: Response-Content-Type
|
||||
//
|
||||
// Example: define 2 api key names for a specific method.
|
||||
//
|
||||
// system_parameters
|
||||
// rules:
|
||||
// - selector: "/ListShelves"
|
||||
// parameters:
|
||||
// - name: api_key
|
||||
// http_header: Api-Key1
|
||||
// - name: api_key
|
||||
// http_header: Api-Key2
|
||||
//
|
||||
// **NOTE:** All service configuration rules follow "last one wins" order.
|
||||
repeated SystemParameterRule rules = 1;
|
||||
}
|
||||
|
||||
// Define a system parameter rule mapping system parameter definitions to
|
||||
// methods.
|
||||
message SystemParameterRule {
|
||||
// Selects the methods to which this rule applies. Use '*' to indicate all
|
||||
// methods in all APIs.
|
||||
//
|
||||
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
||||
string selector = 1;
|
||||
|
||||
// Define parameters. Multiple names may be defined for a parameter.
|
||||
// For a given method call, only one of them should be used. If multiple
|
||||
// names are used the behavior is implementation-dependent.
|
||||
// If none of the specified names are present the behavior is
|
||||
// parameter-dependent.
|
||||
repeated SystemParameter parameters = 2;
|
||||
}
|
||||
|
||||
// Define a parameter's name and location. The parameter may be passed as either
|
||||
// an HTTP header or a URL query parameter, and if both are passed the behavior
|
||||
// is implementation-dependent.
|
||||
message SystemParameter {
|
||||
// Define the name of the parameter, such as "api_key", "alt", "callback",
|
||||
// and etc. It is case sensitive.
|
||||
string name = 1;
|
||||
|
||||
// Define the HTTP header name to use for the parameter. It is case
|
||||
// insensitive.
|
||||
string http_header = 2;
|
||||
|
||||
// Define the URL query parameter name to use for the parameter. It is case
|
||||
// sensitive.
|
||||
string url_query_parameter = 3;
|
||||
}
|
107
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/usage.pb.go
generated
vendored
Normal file
107
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/usage.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,107 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/api/serviceconfig/usage.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_api // import "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
|
||||
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
|
||||
|
||||
// Configuration controlling usage of a service.
|
||||
type Usage struct {
|
||||
// Requirements that must be satisfied before a consumer project can use the
|
||||
// service. Each requirement is of the form <service.name>/<requirement-id>;
|
||||
// for example 'serviceusage.googleapis.com/billing-enabled'.
|
||||
Requirements []string `protobuf:"bytes,1,rep,name=requirements" json:"requirements,omitempty"`
|
||||
// A list of usage rules that apply to individual API methods.
|
||||
//
|
||||
// **NOTE:** All service configuration rules follow "last one wins" order.
|
||||
Rules []*UsageRule `protobuf:"bytes,6,rep,name=rules" json:"rules,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Usage) Reset() { *m = Usage{} }
|
||||
func (m *Usage) String() string { return proto.CompactTextString(m) }
|
||||
func (*Usage) ProtoMessage() {}
|
||||
func (*Usage) Descriptor() ([]byte, []int) { return fileDescriptor15, []int{0} }
|
||||
|
||||
func (m *Usage) GetRules() []*UsageRule {
|
||||
if m != nil {
|
||||
return m.Rules
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Usage configuration rules for the service.
|
||||
//
|
||||
// NOTE: Under development.
|
||||
//
|
||||
//
|
||||
// Use this rule to configure unregistered calls for the service. Unregistered
|
||||
// calls are calls that do not contain consumer project identity.
|
||||
// (Example: calls that do not contain an API key).
|
||||
// By default, API methods do not allow unregistered calls, and each method call
|
||||
// must be identified by a consumer project identity. Use this rule to
|
||||
// allow/disallow unregistered calls.
|
||||
//
|
||||
// Example of an API that wants to allow unregistered calls for entire service.
|
||||
//
|
||||
// usage:
|
||||
// rules:
|
||||
// - selector: "*"
|
||||
// allow_unregistered_calls: true
|
||||
//
|
||||
// Example of a method that wants to allow unregistered calls.
|
||||
//
|
||||
// usage:
|
||||
// rules:
|
||||
// - selector: "google.example.library.v1.LibraryService.CreateBook"
|
||||
// allow_unregistered_calls: true
|
||||
type UsageRule struct {
|
||||
// Selects the methods to which this rule applies. Use '*' to indicate all
|
||||
// methods in all APIs.
|
||||
//
|
||||
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
||||
Selector string `protobuf:"bytes,1,opt,name=selector" json:"selector,omitempty"`
|
||||
// True, if the method allows unregistered calls; false otherwise.
|
||||
AllowUnregisteredCalls bool `protobuf:"varint,2,opt,name=allow_unregistered_calls,json=allowUnregisteredCalls" json:"allow_unregistered_calls,omitempty"`
|
||||
}
|
||||
|
||||
func (m *UsageRule) Reset() { *m = UsageRule{} }
|
||||
func (m *UsageRule) String() string { return proto.CompactTextString(m) }
|
||||
func (*UsageRule) ProtoMessage() {}
|
||||
func (*UsageRule) Descriptor() ([]byte, []int) { return fileDescriptor15, []int{1} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Usage)(nil), "google.api.Usage")
|
||||
proto.RegisterType((*UsageRule)(nil), "google.api.UsageRule")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/api/serviceconfig/usage.proto", fileDescriptor15)
|
||||
}
|
||||
|
||||
var fileDescriptor15 = []byte{
|
||||
// 254 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x8f, 0xc1, 0x4a, 0x03, 0x31,
|
||||
0x10, 0x86, 0xd9, 0x6a, 0x4b, 0x3b, 0x8a, 0x87, 0x05, 0x65, 0xe9, 0x49, 0x16, 0x04, 0x41, 0x48,
|
||||
0x40, 0x2f, 0x5e, 0x6d, 0x0f, 0xd2, 0xdb, 0xb2, 0x50, 0xf0, 0x56, 0x62, 0x1c, 0x43, 0x20, 0xcd,
|
||||
0xd4, 0x4c, 0x56, 0xdf, 0xc7, 0x27, 0x35, 0x9b, 0x95, 0x5a, 0xaf, 0xbd, 0x04, 0xf2, 0x7f, 0x3f,
|
||||
0xdf, 0xcc, 0xc0, 0xd2, 0x10, 0x19, 0x87, 0xc2, 0x90, 0x53, 0xde, 0x08, 0x0a, 0x46, 0x1a, 0xf4,
|
||||
0xbb, 0x40, 0x91, 0xe4, 0x80, 0xd4, 0xce, 0xb2, 0x4c, 0x8f, 0x64, 0x0c, 0x9f, 0x56, 0xa3, 0x26,
|
||||
0xff, 0x6e, 0x8d, 0xec, 0x58, 0x19, 0x14, 0xb9, 0x58, 0xc2, 0xaf, 0x24, 0xb5, 0xe6, 0xab, 0x63,
|
||||
0x85, 0xca, 0x7b, 0x8a, 0x2a, 0x5a, 0xf2, 0x3c, 0x68, 0xeb, 0x17, 0x18, 0xaf, 0xfb, 0x29, 0x65,
|
||||
0x0d, 0xe7, 0x01, 0x3f, 0x3a, 0x1b, 0x70, 0x8b, 0x3e, 0x72, 0x55, 0x5c, 0x9f, 0xdc, 0xce, 0xda,
|
||||
0x7f, 0x59, 0x79, 0x07, 0xe3, 0xd0, 0x39, 0xe4, 0x6a, 0x92, 0xe0, 0xd9, 0xfd, 0xa5, 0xf8, 0xdb,
|
||||
0x49, 0x64, 0x4b, 0x9b, 0x68, 0x3b, 0x74, 0x6a, 0x05, 0xb3, 0x7d, 0x56, 0xce, 0x61, 0xca, 0xe8,
|
||||
0x50, 0x47, 0x0a, 0xc9, 0x5c, 0x24, 0xf3, 0xfe, 0x5f, 0x3e, 0x42, 0xa5, 0x9c, 0xa3, 0xaf, 0x4d,
|
||||
0xe7, 0x03, 0x1a, 0xcb, 0x11, 0x03, 0xbe, 0x6d, 0x74, 0xca, 0xb8, 0x1a, 0xa5, 0xee, 0xb4, 0xbd,
|
||||
0xca, 0x7c, 0x7d, 0x80, 0x97, 0x3d, 0x5d, 0xdc, 0xc0, 0x85, 0xa6, 0xed, 0xc1, 0x16, 0x0b, 0xc8,
|
||||
0x23, 0x9b, 0xfe, 0xb4, 0xa6, 0xf8, 0x1e, 0x9d, 0x3e, 0x3f, 0x35, 0xab, 0xd7, 0x49, 0x3e, 0xf5,
|
||||
0xe1, 0x27, 0x00, 0x00, 0xff, 0xff, 0x72, 0x2d, 0x47, 0x30, 0x88, 0x01, 0x00, 0x00,
|
||||
}
|
74
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/usage.proto
generated
vendored
Normal file
74
vendor/google.golang.org/genproto/googleapis/api/serviceconfig/usage.proto
generated
vendored
Normal file
|
@ -0,0 +1,74 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.api;
|
||||
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto"; // from google/api/annotations.proto
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "UsageProto";
|
||||
option java_package = "com.google.api";
|
||||
option objc_class_prefix = "GAPI";
|
||||
|
||||
|
||||
// Configuration controlling usage of a service.
|
||||
message Usage {
|
||||
// Requirements that must be satisfied before a consumer project can use the
|
||||
// service. Each requirement is of the form <service.name>/<requirement-id>;
|
||||
// for example 'serviceusage.googleapis.com/billing-enabled'.
|
||||
repeated string requirements = 1;
|
||||
|
||||
// A list of usage rules that apply to individual API methods.
|
||||
//
|
||||
// **NOTE:** All service configuration rules follow "last one wins" order.
|
||||
repeated UsageRule rules = 6;
|
||||
}
|
||||
|
||||
// Usage configuration rules for the service.
|
||||
//
|
||||
// NOTE: Under development.
|
||||
//
|
||||
//
|
||||
// Use this rule to configure unregistered calls for the service. Unregistered
|
||||
// calls are calls that do not contain consumer project identity.
|
||||
// (Example: calls that do not contain an API key).
|
||||
// By default, API methods do not allow unregistered calls, and each method call
|
||||
// must be identified by a consumer project identity. Use this rule to
|
||||
// allow/disallow unregistered calls.
|
||||
//
|
||||
// Example of an API that wants to allow unregistered calls for entire service.
|
||||
//
|
||||
// usage:
|
||||
// rules:
|
||||
// - selector: "*"
|
||||
// allow_unregistered_calls: true
|
||||
//
|
||||
// Example of a method that wants to allow unregistered calls.
|
||||
//
|
||||
// usage:
|
||||
// rules:
|
||||
// - selector: "google.example.library.v1.LibraryService.CreateBook"
|
||||
// allow_unregistered_calls: true
|
||||
message UsageRule {
|
||||
// Selects the methods to which this rule applies. Use '*' to indicate all
|
||||
// methods in all APIs.
|
||||
//
|
||||
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
||||
string selector = 1;
|
||||
|
||||
// True, if the method allows unregistered calls; false otherwise.
|
||||
bool allow_unregistered_calls = 2;
|
||||
}
|
134
vendor/google.golang.org/genproto/googleapis/logging/type/http_request.pb.go
generated
vendored
Normal file
134
vendor/google.golang.org/genproto/googleapis/logging/type/http_request.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,134 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/logging/type/http_request.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package google_logging_type is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
google.golang.org/genproto/googleapis/logging/type/http_request.proto
|
||||
google.golang.org/genproto/googleapis/logging/type/log_severity.proto
|
||||
|
||||
It has these top-level messages:
|
||||
HttpRequest
|
||||
*/
|
||||
package google_logging_type // import "google.golang.org/genproto/googleapis/logging/type"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
import google_protobuf1 "github.com/golang/protobuf/ptypes/duration"
|
||||
|
||||
// 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
|
||||
|
||||
// A common proto for logging HTTP requests. Only contains semantics
|
||||
// defined by the HTTP specification. Product-specific logging
|
||||
// information MUST be defined in a separate message.
|
||||
type HttpRequest struct {
|
||||
// The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`.
|
||||
RequestMethod string `protobuf:"bytes,1,opt,name=request_method,json=requestMethod" json:"request_method,omitempty"`
|
||||
// The scheme (http, https), the host name, the path and the query
|
||||
// portion of the URL that was requested.
|
||||
// Example: `"http://example.com/some/info?color=red"`.
|
||||
RequestUrl string `protobuf:"bytes,2,opt,name=request_url,json=requestUrl" json:"request_url,omitempty"`
|
||||
// The size of the HTTP request message in bytes, including the request
|
||||
// headers and the request body.
|
||||
RequestSize int64 `protobuf:"varint,3,opt,name=request_size,json=requestSize" json:"request_size,omitempty"`
|
||||
// The response code indicating the status of response.
|
||||
// Examples: 200, 404.
|
||||
Status int32 `protobuf:"varint,4,opt,name=status" json:"status,omitempty"`
|
||||
// The size of the HTTP response message sent back to the client, in bytes,
|
||||
// including the response headers and the response body.
|
||||
ResponseSize int64 `protobuf:"varint,5,opt,name=response_size,json=responseSize" json:"response_size,omitempty"`
|
||||
// The user agent sent by the client. Example:
|
||||
// `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)"`.
|
||||
UserAgent string `protobuf:"bytes,6,opt,name=user_agent,json=userAgent" json:"user_agent,omitempty"`
|
||||
// The IP address (IPv4 or IPv6) of the client that issued the HTTP
|
||||
// request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`.
|
||||
RemoteIp string `protobuf:"bytes,7,opt,name=remote_ip,json=remoteIp" json:"remote_ip,omitempty"`
|
||||
// The IP address (IPv4 or IPv6) of the origin server that the request was
|
||||
// sent to.
|
||||
ServerIp string `protobuf:"bytes,13,opt,name=server_ip,json=serverIp" json:"server_ip,omitempty"`
|
||||
// The referer URL of the request, as defined in
|
||||
// [HTTP/1.1 Header Field Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
|
||||
Referer string `protobuf:"bytes,8,opt,name=referer" json:"referer,omitempty"`
|
||||
// The request processing latency on the server, from the time the request was
|
||||
// received until the response was sent.
|
||||
Latency *google_protobuf1.Duration `protobuf:"bytes,14,opt,name=latency" json:"latency,omitempty"`
|
||||
// Whether or not a cache lookup was attempted.
|
||||
CacheLookup bool `protobuf:"varint,11,opt,name=cache_lookup,json=cacheLookup" json:"cache_lookup,omitempty"`
|
||||
// Whether or not an entity was served from cache
|
||||
// (with or without validation).
|
||||
CacheHit bool `protobuf:"varint,9,opt,name=cache_hit,json=cacheHit" json:"cache_hit,omitempty"`
|
||||
// Whether or not the response was validated with the origin server before
|
||||
// being served from cache. This field is only meaningful if `cache_hit` is
|
||||
// True.
|
||||
CacheValidatedWithOriginServer bool `protobuf:"varint,10,opt,name=cache_validated_with_origin_server,json=cacheValidatedWithOriginServer" json:"cache_validated_with_origin_server,omitempty"`
|
||||
// The number of HTTP response bytes inserted into cache. Set only when a
|
||||
// cache fill was attempted.
|
||||
CacheFillBytes int64 `protobuf:"varint,12,opt,name=cache_fill_bytes,json=cacheFillBytes" json:"cache_fill_bytes,omitempty"`
|
||||
}
|
||||
|
||||
func (m *HttpRequest) Reset() { *m = HttpRequest{} }
|
||||
func (m *HttpRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*HttpRequest) ProtoMessage() {}
|
||||
func (*HttpRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *HttpRequest) GetLatency() *google_protobuf1.Duration {
|
||||
if m != nil {
|
||||
return m.Latency
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*HttpRequest)(nil), "google.logging.type.HttpRequest")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/logging/type/http_request.proto", fileDescriptor0)
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 477 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x6f, 0x13, 0x31,
|
||||
0x10, 0xc5, 0x15, 0xda, 0xe6, 0x8f, 0x37, 0x8d, 0x2a, 0x23, 0x81, 0x29, 0xe2, 0x5f, 0x11, 0x52,
|
||||
0x2f, 0xac, 0x25, 0x7a, 0xe2, 0x48, 0x04, 0xa8, 0x45, 0x20, 0xaa, 0xad, 0x80, 0xe3, 0x6a, 0xb3,
|
||||
0x71, 0xbc, 0x16, 0xce, 0xda, 0xd8, 0xde, 0xa0, 0xf0, 0x35, 0xf8, 0xc2, 0x8c, 0xc7, 0xbb, 0x88,
|
||||
0x03, 0x87, 0x5e, 0xa2, 0xec, 0xef, 0xbd, 0x37, 0x1e, 0x8f, 0x87, 0xbc, 0x93, 0xc6, 0x48, 0x2d,
|
||||
0x72, 0x69, 0x74, 0xd5, 0xca, 0xdc, 0x38, 0xc9, 0xa5, 0x68, 0xad, 0x33, 0xc1, 0xf0, 0x24, 0x55,
|
||||
0x56, 0x79, 0xae, 0x8d, 0x94, 0xaa, 0x95, 0x3c, 0xec, 0xad, 0xe0, 0x4d, 0x08, 0xb6, 0x74, 0xe2,
|
||||
0x47, 0x27, 0x7c, 0xc8, 0xd1, 0x4a, 0xef, 0xf6, 0x65, 0x7a, 0x5f, 0x1e, 0x7d, 0xa7, 0x57, 0xb7,
|
||||
0xab, 0x0d, 0x3f, 0xdc, 0x0b, 0xb7, 0x53, 0xb5, 0xa8, 0x4d, 0xbb, 0x51, 0x92, 0x57, 0x6d, 0x6b,
|
||||
0x42, 0x15, 0x94, 0x69, 0x7d, 0xaa, 0x7f, 0xfa, 0x5a, 0xaa, 0xd0, 0x74, 0xab, 0xbc, 0x36, 0x5b,
|
||||
0x9e, 0xca, 0x71, 0x14, 0x56, 0xdd, 0x86, 0xdb, 0x78, 0x98, 0xe7, 0xeb, 0xce, 0x61, 0xe4, 0xef,
|
||||
0x9f, 0x14, 0x3d, 0xfb, 0x7d, 0x48, 0xb2, 0x4b, 0xe8, 0xb8, 0x48, 0x0d, 0xd3, 0x17, 0x64, 0xd1,
|
||||
0xf7, 0x5e, 0x6e, 0x45, 0x68, 0xcc, 0x9a, 0x8d, 0x9e, 0x8e, 0xce, 0x67, 0xc5, 0x71, 0x4f, 0x3f,
|
||||
0x21, 0xa4, 0x4f, 0x48, 0x36, 0xd8, 0x3a, 0xa7, 0xd9, 0x1d, 0xf4, 0x90, 0x1e, 0x7d, 0x71, 0x9a,
|
||||
0x3e, 0x23, 0xf3, 0xc1, 0xe0, 0xd5, 0x2f, 0xc1, 0x0e, 0xc0, 0x71, 0x50, 0x0c, 0xa1, 0x1b, 0x40,
|
||||
0xf4, 0x1e, 0x19, 0x7b, 0xb8, 0x47, 0xe7, 0xd9, 0x21, 0x88, 0x47, 0x45, 0xff, 0x45, 0x9f, 0x13,
|
||||
0x38, 0xcc, 0x5b, 0xb8, 0x9e, 0x48, 0xd9, 0x23, 0xcc, 0xce, 0x07, 0x88, 0xe1, 0x47, 0x84, 0x74,
|
||||
0x30, 0x96, 0xb2, 0x82, 0x99, 0x05, 0x36, 0xc6, 0xf3, 0x67, 0x91, 0xbc, 0x89, 0x80, 0x3e, 0x24,
|
||||
0x33, 0x27, 0xb6, 0x26, 0x88, 0x52, 0x59, 0x36, 0x41, 0x75, 0x9a, 0xc0, 0x95, 0x8d, 0x62, 0x9c,
|
||||
0x28, 0xa4, 0x41, 0x3c, 0x4e, 0x62, 0x02, 0x20, 0x32, 0x32, 0x71, 0x62, 0x23, 0x9c, 0x70, 0x6c,
|
||||
0x8a, 0xd2, 0xf0, 0x49, 0x2f, 0xc8, 0x44, 0x57, 0x41, 0xb4, 0xf5, 0x9e, 0x2d, 0x40, 0xc9, 0x5e,
|
||||
0x3d, 0xc8, 0xfb, 0x27, 0x1c, 0x86, 0x9d, 0xbf, 0xed, 0x87, 0x5b, 0x0c, 0xce, 0x38, 0x87, 0xba,
|
||||
0xaa, 0x1b, 0x51, 0x6a, 0x63, 0xbe, 0x77, 0x96, 0x65, 0x90, 0x9c, 0x16, 0x19, 0xb2, 0x8f, 0x88,
|
||||
0x62, 0x3b, 0xc9, 0xd2, 0xa8, 0xc0, 0x66, 0xa8, 0x4f, 0x11, 0x5c, 0xaa, 0x40, 0x3f, 0x90, 0xb3,
|
||||
0x24, 0xee, 0x2a, 0xad, 0xd6, 0x50, 0x74, 0x5d, 0xfe, 0x84, 0xc7, 0x2e, 0x8d, 0x53, 0xb0, 0x4a,
|
||||
0x65, 0x6a, 0x9b, 0x11, 0x4c, 0x3d, 0x46, 0xe7, 0xd7, 0xc1, 0xf8, 0x0d, 0x7c, 0x9f, 0xd1, 0x76,
|
||||
0x83, 0x2e, 0x7a, 0x4e, 0x4e, 0x52, 0xad, 0x8d, 0xd2, 0xba, 0x5c, 0xed, 0x83, 0xf0, 0x6c, 0x8e,
|
||||
0xb3, 0x5d, 0x20, 0x7f, 0x0f, 0x78, 0x19, 0xe9, 0xf2, 0x25, 0xb9, 0x0f, 0xbb, 0x94, 0xff, 0x67,
|
||||
0x6d, 0x97, 0x27, 0xff, 0x6c, 0xcb, 0x75, 0xbc, 0xf7, 0xf5, 0x68, 0x35, 0xc6, 0x01, 0x5c, 0xfc,
|
||||
0x09, 0x00, 0x00, 0xff, 0xff, 0x4b, 0x1c, 0x8f, 0x8c, 0x2f, 0x03, 0x00, 0x00,
|
||||
}
|
86
vendor/google.golang.org/genproto/googleapis/logging/type/http_request.proto
generated
vendored
Normal file
86
vendor/google.golang.org/genproto/googleapis/logging/type/http_request.proto
generated
vendored
Normal file
|
@ -0,0 +1,86 @@
|
|||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.logging.type;
|
||||
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto"; // from google/api/annotations.proto
|
||||
import "github.com/golang/protobuf/ptypes/duration/duration.proto"; // from google/protobuf/duration.proto
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "HttpRequestProto";
|
||||
option java_package = "com.google.logging.type";
|
||||
|
||||
|
||||
// A common proto for logging HTTP requests. Only contains semantics
|
||||
// defined by the HTTP specification. Product-specific logging
|
||||
// information MUST be defined in a separate message.
|
||||
message HttpRequest {
|
||||
// The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`.
|
||||
string request_method = 1;
|
||||
|
||||
// The scheme (http, https), the host name, the path and the query
|
||||
// portion of the URL that was requested.
|
||||
// Example: `"http://example.com/some/info?color=red"`.
|
||||
string request_url = 2;
|
||||
|
||||
// The size of the HTTP request message in bytes, including the request
|
||||
// headers and the request body.
|
||||
int64 request_size = 3;
|
||||
|
||||
// The response code indicating the status of response.
|
||||
// Examples: 200, 404.
|
||||
int32 status = 4;
|
||||
|
||||
// The size of the HTTP response message sent back to the client, in bytes,
|
||||
// including the response headers and the response body.
|
||||
int64 response_size = 5;
|
||||
|
||||
// The user agent sent by the client. Example:
|
||||
// `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)"`.
|
||||
string user_agent = 6;
|
||||
|
||||
// The IP address (IPv4 or IPv6) of the client that issued the HTTP
|
||||
// request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`.
|
||||
string remote_ip = 7;
|
||||
|
||||
// The IP address (IPv4 or IPv6) of the origin server that the request was
|
||||
// sent to.
|
||||
string server_ip = 13;
|
||||
|
||||
// The referer URL of the request, as defined in
|
||||
// [HTTP/1.1 Header Field Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
|
||||
string referer = 8;
|
||||
|
||||
// The request processing latency on the server, from the time the request was
|
||||
// received until the response was sent.
|
||||
google.protobuf.Duration latency = 14;
|
||||
|
||||
// Whether or not a cache lookup was attempted.
|
||||
bool cache_lookup = 11;
|
||||
|
||||
// Whether or not an entity was served from cache
|
||||
// (with or without validation).
|
||||
bool cache_hit = 9;
|
||||
|
||||
// Whether or not the response was validated with the origin server before
|
||||
// being served from cache. This field is only meaningful if `cache_hit` is
|
||||
// True.
|
||||
bool cache_validated_with_origin_server = 10;
|
||||
|
||||
// The number of HTTP response bytes inserted into cache. Set only when a
|
||||
// cache fill was attempted.
|
||||
int64 cache_fill_bytes = 12;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue