vendor: google.golang.org/cloud -> cloud.google.com/go
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp> Upstream-commit: ff2f8755741a3c5bdd29bab9c36985c6d05d531a Component: engine
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -89,11 +89,10 @@ github.com/bsphere/le_go d3308aafe090956bc89a65f0769f58251a1b4f03
|
||||
|
||||
# gcplogs deps
|
||||
golang.org/x/oauth2 96382aa079b72d8c014eb0c50f6c223d1e6a2de0
|
||||
google.golang.org/api dc6d2353af16e2a2b0ff6986af051d473a4ed468
|
||||
# TODO: remove google.golang.org/cloud, which has been replaced by cloud.google.com/go
|
||||
google.golang.org/cloud dae7e3d993bc3812a2185af60552bb6b847e52a0
|
||||
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
|
||||
|
||||
+300
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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"
|
||||
Generated
Vendored
+13
-12
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+200
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+119
@@ -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;
|
||||
}
|
||||
-177
@@ -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
@@ -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
@@ -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, ",")
|
||||
}
|
||||
Generated
Vendored
-18
@@ -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.
|
||||
Generated
Vendored
-359
@@ -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
|
||||
}
|
||||
Generated
Vendored
-13
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
File diff suppressed because it is too large
Load Diff
+142
@@ -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
@@ -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
@@ -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
|
||||
}
|
||||
Generated
Vendored
+15
-12
@@ -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
@@ -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)
|
||||
}
|
||||
-327
@@ -1,327 +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 metadata provides access to Google Compute Engine (GCE)
|
||||
// metadata and API service accounts.
|
||||
//
|
||||
// This package is a wrapper around the GCE metadata service,
|
||||
// as documented at https://developers.google.com/compute/docs/metadata.
|
||||
package metadata // import "google.golang.org/cloud/compute/metadata"
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"google.golang.org/cloud/internal"
|
||||
)
|
||||
|
||||
type cachedValue struct {
|
||||
k string
|
||||
trim bool
|
||||
mu sync.Mutex
|
||||
v string
|
||||
}
|
||||
|
||||
var (
|
||||
projID = &cachedValue{k: "project/project-id", trim: true}
|
||||
projNum = &cachedValue{k: "project/numeric-project-id", trim: true}
|
||||
instID = &cachedValue{k: "instance/id", trim: true}
|
||||
)
|
||||
|
||||
var 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,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// NotDefinedError is returned when requested metadata is not defined.
|
||||
//
|
||||
// The underlying string is the suffix after "/computeMetadata/v1/".
|
||||
//
|
||||
// This error is not returned if the value is defined to be the empty
|
||||
// string.
|
||||
type NotDefinedError string
|
||||
|
||||
func (suffix NotDefinedError) Error() string {
|
||||
return fmt.Sprintf("metadata: GCE metadata %q not defined", string(suffix))
|
||||
}
|
||||
|
||||
// Get returns a value from the metadata service.
|
||||
// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/".
|
||||
//
|
||||
// If the GCE_METADATA_HOST environment variable is not defined, a default of
|
||||
// 169.254.169.254 will be used instead.
|
||||
//
|
||||
// If the requested metadata is not defined, the returned error will
|
||||
// be of type NotDefinedError.
|
||||
func Get(suffix string) (string, error) {
|
||||
val, _, err := getETag(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) {
|
||||
// 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")
|
||||
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"
|
||||
}
|
||||
url := "http://" + host + "/computeMetadata/v1/" + suffix
|
||||
req, _ := http.NewRequest("GET", url, nil)
|
||||
req.Header.Set("Metadata-Flavor", "Google")
|
||||
res, err := metaClient.Do(req)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode == http.StatusNotFound {
|
||||
return "", "", NotDefinedError(suffix)
|
||||
}
|
||||
if res.StatusCode != 200 {
|
||||
return "", "", fmt.Errorf("status code %d trying to fetch %s", res.StatusCode, url)
|
||||
}
|
||||
all, err := ioutil.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
return string(all), res.Header.Get("Etag"), nil
|
||||
}
|
||||
|
||||
func getTrimmed(suffix string) (s string, err error) {
|
||||
s, err = Get(suffix)
|
||||
s = strings.TrimSpace(s)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *cachedValue) get() (v string, err error) {
|
||||
defer c.mu.Unlock()
|
||||
c.mu.Lock()
|
||||
if c.v != "" {
|
||||
return c.v, nil
|
||||
}
|
||||
if c.trim {
|
||||
v, err = getTrimmed(c.k)
|
||||
} else {
|
||||
v, err = Get(c.k)
|
||||
}
|
||||
if err == nil {
|
||||
c.v = v
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var onGCE struct {
|
||||
sync.Mutex
|
||||
set bool
|
||||
v 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
|
||||
|
||||
// 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 {
|
||||
return false
|
||||
}
|
||||
onGCE.v = res.Header.Get("Metadata-Flavor") == "Google"
|
||||
return onGCE.v
|
||||
}
|
||||
|
||||
// Subscribe subscribes to a value from the metadata service.
|
||||
// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/".
|
||||
//
|
||||
// Subscribe calls fn with the latest metadata value indicated by the provided
|
||||
// suffix. If the metadata value is deleted, fn is called with the empty string
|
||||
// and ok false. Subscribe blocks until fn returns a non-nil error or the value
|
||||
// is deleted. Subscribe returns the error value returned from the last call to
|
||||
// fn, which may be nil when ok == false.
|
||||
func 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)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := fn(val, true); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ok := true
|
||||
suffix += "?wait_for_change=true&last_etag="
|
||||
for {
|
||||
val, etag, err := getETag(suffix + url.QueryEscape(lastETag))
|
||||
if err != nil {
|
||||
if _, deleted := err.(NotDefinedError); !deleted {
|
||||
time.Sleep(failedSubscribeSleep)
|
||||
continue // Retry on other errors.
|
||||
}
|
||||
ok = false
|
||||
}
|
||||
lastETag = etag
|
||||
|
||||
if err := fn(val, ok); err != nil || !ok {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ProjectID returns the current instance's project ID string.
|
||||
func ProjectID() (string, error) { return projID.get() }
|
||||
|
||||
// NumericProjectID returns the current instance's numeric project ID.
|
||||
func NumericProjectID() (string, error) { return projNum.get() }
|
||||
|
||||
// InternalIP returns the instance's primary internal IP address.
|
||||
func InternalIP() (string, error) {
|
||||
return getTrimmed("instance/network-interfaces/0/ip")
|
||||
}
|
||||
|
||||
// ExternalIP returns the instance's primary external (public) IP address.
|
||||
func ExternalIP() (string, error) {
|
||||
return getTrimmed("instance/network-interfaces/0/access-configs/0/external-ip")
|
||||
}
|
||||
|
||||
// Hostname returns the instance's hostname. This will be of the form
|
||||
// "<instanceID>.c.<projID>.internal".
|
||||
func Hostname() (string, error) {
|
||||
return getTrimmed("instance/hostname")
|
||||
}
|
||||
|
||||
// InstanceTags returns the list of user-defined instance tags,
|
||||
// assigned when initially creating a GCE instance.
|
||||
func InstanceTags() ([]string, error) {
|
||||
var s []string
|
||||
j, err := Get("instance/tags")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := json.NewDecoder(strings.NewReader(j)).Decode(&s); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
||||
// InstanceID returns the current VM's numeric instance ID.
|
||||
func InstanceID() (string, error) {
|
||||
return instID.get()
|
||||
}
|
||||
|
||||
// InstanceName returns the current VM's instance ID string.
|
||||
func InstanceName() (string, error) {
|
||||
host, err := Hostname()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return strings.Split(host, ".")[0], nil
|
||||
}
|
||||
|
||||
// Zone returns the current VM's zone, such as "us-central1-b".
|
||||
func Zone() (string, error) {
|
||||
zone, err := getTrimmed("instance/zone")
|
||||
// zone is of the form "projects/<projNum>/zones/<zoneName>".
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return zone[strings.LastIndex(zone, "/")+1:], nil
|
||||
}
|
||||
|
||||
// InstanceAttributes returns the list of user-defined attributes,
|
||||
// assigned when initially creating a GCE VM instance. The value of an
|
||||
// attribute can be obtained with InstanceAttributeValue.
|
||||
func InstanceAttributes() ([]string, error) { return lines("instance/attributes/") }
|
||||
|
||||
// ProjectAttributes returns the list of user-defined attributes
|
||||
// applying to the project as a whole, not just this VM. The value of
|
||||
// an attribute can be obtained with ProjectAttributeValue.
|
||||
func ProjectAttributes() ([]string, error) { return lines("project/attributes/") }
|
||||
|
||||
func lines(suffix string) ([]string, error) {
|
||||
j, err := Get(suffix)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s := strings.Split(strings.TrimSpace(j), "\n")
|
||||
for i := range s {
|
||||
s[i] = strings.TrimSpace(s[i])
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
||||
// InstanceAttributeValue returns the value of the provided VM
|
||||
// instance attribute.
|
||||
//
|
||||
// If the requested attribute is not defined, the returned error will
|
||||
// be of type NotDefinedError.
|
||||
//
|
||||
// InstanceAttributeValue may return ("", nil) if the attribute was
|
||||
// defined to be the empty string.
|
||||
func InstanceAttributeValue(attr string) (string, error) {
|
||||
return Get("instance/attributes/" + attr)
|
||||
}
|
||||
|
||||
// ProjectAttributeValue returns the value of the provided
|
||||
// project attribute.
|
||||
//
|
||||
// If the requested attribute is not defined, the returned error will
|
||||
// be of type NotDefinedError.
|
||||
//
|
||||
// ProjectAttributeValue may return ("", nil) if the attribute was
|
||||
// defined to be the empty string.
|
||||
func ProjectAttributeValue(attr string) (string, error) {
|
||||
return Get("project/attributes/" + attr)
|
||||
}
|
||||
|
||||
// Scopes returns the service account scopes for the given account.
|
||||
// The account may be empty or the string "default" to use the instance's
|
||||
// main account.
|
||||
func Scopes(serviceAccount string) ([]string, error) {
|
||||
if serviceAccount == "" {
|
||||
serviceAccount = "default"
|
||||
}
|
||||
return lines("instance/service-accounts/" + serviceAccount + "/scopes")
|
||||
}
|
||||
-128
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
|
||||
}
|
||||
Generated
Vendored
+1
-1
@@ -187,7 +187,7 @@
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2014 Google Inc.
|
||||
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.
|
||||
Generated
Vendored
+100
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+48
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+303
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+193
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+148
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+91
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+108
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+30
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+242
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+164
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+79
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+46
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+131
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+97
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+139
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+82
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+95
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+62
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+50
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+32
@@ -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;
|
||||
}
|
||||
components/engine/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/documentation.pb.go
Generated
Vendored
+213
@@ -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,
|
||||
}
|
||||
components/engine/vendor/google.golang.org/genproto/googleapis/api/serviceconfig/documentation.proto
Generated
Vendored
+158
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+106
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+89
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+535
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+285
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+80
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+54
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+123
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+82
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+131
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+88
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+305
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+157
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+146
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+97
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+107
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+74
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+134
@@ -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,
|
||||
}
|
||||
Generated
Vendored
+86
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+112
@@ -0,0 +1,112 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/logging/type/log_severity.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
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"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// The severity of the event described in a log entry, expressed as one of the
|
||||
// standard severity levels listed below. For your reference, the levels are
|
||||
// assigned the listed numeric values. The effect of using numeric values other
|
||||
// than those listed is undefined.
|
||||
//
|
||||
// You can filter for log entries by severity. For example, the following
|
||||
// filter expression will match log entries with severities `INFO`, `NOTICE`,
|
||||
// and `WARNING`:
|
||||
//
|
||||
// severity > DEBUG AND severity <= WARNING
|
||||
//
|
||||
// If you are writing log entries, you should map other severity encodings to
|
||||
// one of these standard levels. For example, you might map all of Java's FINE,
|
||||
// FINER, and FINEST levels to `LogSeverity.DEBUG`. You can preserve the
|
||||
// original severity level in the log entry payload if you wish.
|
||||
type LogSeverity int32
|
||||
|
||||
const (
|
||||
// (0) The log entry has no assigned severity level.
|
||||
LogSeverity_DEFAULT LogSeverity = 0
|
||||
// (100) Debug or trace information.
|
||||
LogSeverity_DEBUG LogSeverity = 100
|
||||
// (200) Routine information, such as ongoing status or performance.
|
||||
LogSeverity_INFO LogSeverity = 200
|
||||
// (300) Normal but significant events, such as start up, shut down, or
|
||||
// a configuration change.
|
||||
LogSeverity_NOTICE LogSeverity = 300
|
||||
// (400) Warning events might cause problems.
|
||||
LogSeverity_WARNING LogSeverity = 400
|
||||
// (500) Error events are likely to cause problems.
|
||||
LogSeverity_ERROR LogSeverity = 500
|
||||
// (600) Critical events cause more severe problems or outages.
|
||||
LogSeverity_CRITICAL LogSeverity = 600
|
||||
// (700) A person must take an action immediately.
|
||||
LogSeverity_ALERT LogSeverity = 700
|
||||
// (800) One or more systems are unusable.
|
||||
LogSeverity_EMERGENCY LogSeverity = 800
|
||||
)
|
||||
|
||||
var LogSeverity_name = map[int32]string{
|
||||
0: "DEFAULT",
|
||||
100: "DEBUG",
|
||||
200: "INFO",
|
||||
300: "NOTICE",
|
||||
400: "WARNING",
|
||||
500: "ERROR",
|
||||
600: "CRITICAL",
|
||||
700: "ALERT",
|
||||
800: "EMERGENCY",
|
||||
}
|
||||
var LogSeverity_value = map[string]int32{
|
||||
"DEFAULT": 0,
|
||||
"DEBUG": 100,
|
||||
"INFO": 200,
|
||||
"NOTICE": 300,
|
||||
"WARNING": 400,
|
||||
"ERROR": 500,
|
||||
"CRITICAL": 600,
|
||||
"ALERT": 700,
|
||||
"EMERGENCY": 800,
|
||||
}
|
||||
|
||||
func (x LogSeverity) String() string {
|
||||
return proto.EnumName(LogSeverity_name, int32(x))
|
||||
}
|
||||
func (LogSeverity) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterEnum("google.logging.type.LogSeverity", LogSeverity_name, LogSeverity_value)
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/logging/type/log_severity.proto", fileDescriptor1)
|
||||
}
|
||||
|
||||
var fileDescriptor1 = []byte{
|
||||
// 278 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, 0xe7, 0xe4,
|
||||
0xa7, 0xa7, 0x67, 0xe6, 0xa5, 0xeb, 0x97, 0x54, 0x16, 0xa4, 0x82, 0x38, 0xf1, 0xc5, 0xa9, 0x65,
|
||||
0xa9, 0x45, 0x99, 0x25, 0x95, 0x7a, 0x60, 0xa5, 0x42, 0xc2, 0x50, 0x63, 0xa0, 0xea, 0xf4, 0x40,
|
||||
0xea, 0xa4, 0x3c, 0x89, 0x33, 0x1b, 0x48, 0xe8, 0x17, 0xa7, 0x16, 0x95, 0x65, 0x26, 0xa7, 0x26,
|
||||
0xe7, 0xe7, 0xa5, 0x65, 0xa6, 0xeb, 0x27, 0xe6, 0xe5, 0xe5, 0x97, 0x24, 0x96, 0x64, 0xe6, 0xe7,
|
||||
0x15, 0x43, 0xcc, 0xd7, 0x6a, 0x62, 0xe4, 0xe2, 0xf6, 0xc9, 0x4f, 0x0f, 0x86, 0xda, 0x2a, 0xc4,
|
||||
0xcd, 0xc5, 0xee, 0xe2, 0xea, 0xe6, 0x18, 0xea, 0x13, 0x22, 0xc0, 0x20, 0xc4, 0xc9, 0xc5, 0xea,
|
||||
0xe2, 0xea, 0x14, 0xea, 0x2e, 0x90, 0x02, 0x64, 0xb2, 0x78, 0xfa, 0xb9, 0xf9, 0x0b, 0x9c, 0x60,
|
||||
0x04, 0x2a, 0x61, 0xf3, 0xf3, 0x0f, 0xf1, 0x74, 0x76, 0x15, 0x58, 0xc3, 0x24, 0xc4, 0xc3, 0xc5,
|
||||
0x1e, 0xee, 0x18, 0xe4, 0xe7, 0xe9, 0xe7, 0x2e, 0x30, 0x81, 0x59, 0x88, 0x8b, 0x8b, 0xd5, 0x35,
|
||||
0x28, 0xc8, 0x3f, 0x48, 0xe0, 0x0b, 0xb3, 0x10, 0x2f, 0x17, 0x87, 0x73, 0x90, 0x27, 0x50, 0x9d,
|
||||
0xa3, 0x8f, 0xc0, 0x0d, 0x16, 0x90, 0x94, 0xa3, 0x8f, 0x6b, 0x50, 0x88, 0xc0, 0x1e, 0x56, 0x21,
|
||||
0x3e, 0x2e, 0x4e, 0x57, 0x5f, 0xd7, 0x20, 0x77, 0x57, 0x3f, 0xe7, 0x48, 0x81, 0x05, 0x6c, 0x4e,
|
||||
0xba, 0x5c, 0xe2, 0xc9, 0xf9, 0xb9, 0x7a, 0x58, 0xbc, 0xea, 0x24, 0x80, 0xe4, 0xb8, 0x00, 0x90,
|
||||
0x8b, 0x03, 0x18, 0x93, 0xd8, 0xc0, 0x4e, 0x37, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x01, 0xa8,
|
||||
0xad, 0x71, 0x63, 0x01, 0x00, 0x00,
|
||||
}
|
||||
Generated
Vendored
+69
@@ -0,0 +1,69 @@
|
||||
// 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
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "LogSeverityProto";
|
||||
option java_package = "com.google.logging.type";
|
||||
|
||||
|
||||
// The severity of the event described in a log entry, expressed as one of the
|
||||
// standard severity levels listed below. For your reference, the levels are
|
||||
// assigned the listed numeric values. The effect of using numeric values other
|
||||
// than those listed is undefined.
|
||||
//
|
||||
// You can filter for log entries by severity. For example, the following
|
||||
// filter expression will match log entries with severities `INFO`, `NOTICE`,
|
||||
// and `WARNING`:
|
||||
//
|
||||
// severity > DEBUG AND severity <= WARNING
|
||||
//
|
||||
// If you are writing log entries, you should map other severity encodings to
|
||||
// one of these standard levels. For example, you might map all of Java's FINE,
|
||||
// FINER, and FINEST levels to `LogSeverity.DEBUG`. You can preserve the
|
||||
// original severity level in the log entry payload if you wish.
|
||||
enum LogSeverity {
|
||||
// (0) The log entry has no assigned severity level.
|
||||
DEFAULT = 0;
|
||||
|
||||
// (100) Debug or trace information.
|
||||
DEBUG = 100;
|
||||
|
||||
// (200) Routine information, such as ongoing status or performance.
|
||||
INFO = 200;
|
||||
|
||||
// (300) Normal but significant events, such as start up, shut down, or
|
||||
// a configuration change.
|
||||
NOTICE = 300;
|
||||
|
||||
// (400) Warning events might cause problems.
|
||||
WARNING = 400;
|
||||
|
||||
// (500) Error events are likely to cause problems.
|
||||
ERROR = 500;
|
||||
|
||||
// (600) Critical events cause more severe problems or outages.
|
||||
CRITICAL = 600;
|
||||
|
||||
// (700) A person must take an action immediately.
|
||||
ALERT = 700;
|
||||
|
||||
// (800) One or more systems are unusable.
|
||||
EMERGENCY = 800;
|
||||
}
|
||||
Generated
Vendored
+358
@@ -0,0 +1,358 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/logging/v2/log_entry.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package v2 is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
google.golang.org/genproto/googleapis/logging/v2/log_entry.proto
|
||||
google.golang.org/genproto/googleapis/logging/v2/logging.proto
|
||||
google.golang.org/genproto/googleapis/logging/v2/logging_config.proto
|
||||
google.golang.org/genproto/googleapis/logging/v2/logging_metrics.proto
|
||||
|
||||
It has these top-level messages:
|
||||
LogEntry
|
||||
LogEntryOperation
|
||||
DeleteLogRequest
|
||||
WriteLogEntriesRequest
|
||||
WriteLogEntriesResponse
|
||||
ListLogEntriesRequest
|
||||
ListLogEntriesResponse
|
||||
ListMonitoredResourceDescriptorsRequest
|
||||
ListMonitoredResourceDescriptorsResponse
|
||||
LogSink
|
||||
ListSinksRequest
|
||||
ListSinksResponse
|
||||
GetSinkRequest
|
||||
CreateSinkRequest
|
||||
UpdateSinkRequest
|
||||
DeleteSinkRequest
|
||||
LogMetric
|
||||
ListLogMetricsRequest
|
||||
ListLogMetricsResponse
|
||||
GetLogMetricRequest
|
||||
CreateLogMetricRequest
|
||||
UpdateLogMetricRequest
|
||||
DeleteLogMetricRequest
|
||||
*/
|
||||
package v2 // import "google.golang.org/genproto/googleapis/logging/v2"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
import google_api3 "google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
import google_logging_type "google.golang.org/genproto/googleapis/logging/type"
|
||||
import google_logging_type1 "google.golang.org/genproto/googleapis/logging/type"
|
||||
import google_protobuf2 "github.com/golang/protobuf/ptypes/any"
|
||||
import google_protobuf3 "github.com/golang/protobuf/ptypes/struct"
|
||||
import google_protobuf4 "github.com/golang/protobuf/ptypes/timestamp"
|
||||
|
||||
// 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 individual entry in a log.
|
||||
type LogEntry struct {
|
||||
// Required. The resource name of the log to which this log entry
|
||||
// belongs. The format of the name is
|
||||
// `"projects/<project-id>/logs/<log-id>"`. Examples:
|
||||
// `"projects/my-projectid/logs/syslog"`,
|
||||
// `"projects/my-projectid/logs/library.googleapis.com%2Fbook_log"`.
|
||||
//
|
||||
// The log ID part of resource name 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.
|
||||
// Forward-slash (`/`) characters in the log ID must be URL-encoded.
|
||||
LogName string `protobuf:"bytes,12,opt,name=log_name,json=logName" json:"log_name,omitempty"`
|
||||
// Required. The monitored resource associated with this log entry.
|
||||
// Example: a log entry that reports a database error would be
|
||||
// associated with the monitored resource designating the particular
|
||||
// database that reported the error.
|
||||
Resource *google_api3.MonitoredResource `protobuf:"bytes,8,opt,name=resource" json:"resource,omitempty"`
|
||||
// Optional. The log entry payload, which can be one of multiple types.
|
||||
//
|
||||
// Types that are valid to be assigned to Payload:
|
||||
// *LogEntry_ProtoPayload
|
||||
// *LogEntry_TextPayload
|
||||
// *LogEntry_JsonPayload
|
||||
Payload isLogEntry_Payload `protobuf_oneof:"payload"`
|
||||
// Optional. The time the event described by the log entry occurred. If
|
||||
// omitted, Stackdriver Logging will use the time the log entry is received.
|
||||
Timestamp *google_protobuf4.Timestamp `protobuf:"bytes,9,opt,name=timestamp" json:"timestamp,omitempty"`
|
||||
// Optional. The severity of the log entry. The default value is
|
||||
// `LogSeverity.DEFAULT`.
|
||||
Severity google_logging_type1.LogSeverity `protobuf:"varint,10,opt,name=severity,enum=google.logging.type.LogSeverity" json:"severity,omitempty"`
|
||||
// Optional. A unique ID for the log entry. If you provide this
|
||||
// field, the logging service considers other log entries in the
|
||||
// same project with the same ID as duplicates which can be removed. If
|
||||
// omitted, Stackdriver Logging will generate a unique ID for this
|
||||
// log entry.
|
||||
InsertId string `protobuf:"bytes,4,opt,name=insert_id,json=insertId" json:"insert_id,omitempty"`
|
||||
// Optional. Information about the HTTP request associated with this
|
||||
// log entry, if applicable.
|
||||
HttpRequest *google_logging_type.HttpRequest `protobuf:"bytes,7,opt,name=http_request,json=httpRequest" json:"http_request,omitempty"`
|
||||
// Optional. A set of user-defined (key, value) data that provides additional
|
||||
// information about the log entry.
|
||||
Labels map[string]string `protobuf:"bytes,11,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
// Optional. Information about an operation associated with the log entry, if
|
||||
// applicable.
|
||||
Operation *LogEntryOperation `protobuf:"bytes,15,opt,name=operation" json:"operation,omitempty"`
|
||||
}
|
||||
|
||||
func (m *LogEntry) Reset() { *m = LogEntry{} }
|
||||
func (m *LogEntry) String() string { return proto.CompactTextString(m) }
|
||||
func (*LogEntry) ProtoMessage() {}
|
||||
func (*LogEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
type isLogEntry_Payload interface {
|
||||
isLogEntry_Payload()
|
||||
}
|
||||
|
||||
type LogEntry_ProtoPayload struct {
|
||||
ProtoPayload *google_protobuf2.Any `protobuf:"bytes,2,opt,name=proto_payload,json=protoPayload,oneof"`
|
||||
}
|
||||
type LogEntry_TextPayload struct {
|
||||
TextPayload string `protobuf:"bytes,3,opt,name=text_payload,json=textPayload,oneof"`
|
||||
}
|
||||
type LogEntry_JsonPayload struct {
|
||||
JsonPayload *google_protobuf3.Struct `protobuf:"bytes,6,opt,name=json_payload,json=jsonPayload,oneof"`
|
||||
}
|
||||
|
||||
func (*LogEntry_ProtoPayload) isLogEntry_Payload() {}
|
||||
func (*LogEntry_TextPayload) isLogEntry_Payload() {}
|
||||
func (*LogEntry_JsonPayload) isLogEntry_Payload() {}
|
||||
|
||||
func (m *LogEntry) GetPayload() isLogEntry_Payload {
|
||||
if m != nil {
|
||||
return m.Payload
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LogEntry) GetResource() *google_api3.MonitoredResource {
|
||||
if m != nil {
|
||||
return m.Resource
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LogEntry) GetProtoPayload() *google_protobuf2.Any {
|
||||
if x, ok := m.GetPayload().(*LogEntry_ProtoPayload); ok {
|
||||
return x.ProtoPayload
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LogEntry) GetTextPayload() string {
|
||||
if x, ok := m.GetPayload().(*LogEntry_TextPayload); ok {
|
||||
return x.TextPayload
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *LogEntry) GetJsonPayload() *google_protobuf3.Struct {
|
||||
if x, ok := m.GetPayload().(*LogEntry_JsonPayload); ok {
|
||||
return x.JsonPayload
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LogEntry) GetTimestamp() *google_protobuf4.Timestamp {
|
||||
if m != nil {
|
||||
return m.Timestamp
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LogEntry) GetHttpRequest() *google_logging_type.HttpRequest {
|
||||
if m != nil {
|
||||
return m.HttpRequest
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LogEntry) GetLabels() map[string]string {
|
||||
if m != nil {
|
||||
return m.Labels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LogEntry) GetOperation() *LogEntryOperation {
|
||||
if m != nil {
|
||||
return m.Operation
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*LogEntry) 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 _LogEntry_OneofMarshaler, _LogEntry_OneofUnmarshaler, _LogEntry_OneofSizer, []interface{}{
|
||||
(*LogEntry_ProtoPayload)(nil),
|
||||
(*LogEntry_TextPayload)(nil),
|
||||
(*LogEntry_JsonPayload)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _LogEntry_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*LogEntry)
|
||||
// payload
|
||||
switch x := m.Payload.(type) {
|
||||
case *LogEntry_ProtoPayload:
|
||||
b.EncodeVarint(2<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.ProtoPayload); err != nil {
|
||||
return err
|
||||
}
|
||||
case *LogEntry_TextPayload:
|
||||
b.EncodeVarint(3<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.TextPayload)
|
||||
case *LogEntry_JsonPayload:
|
||||
b.EncodeVarint(6<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.JsonPayload); err != nil {
|
||||
return err
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("LogEntry.Payload has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _LogEntry_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*LogEntry)
|
||||
switch tag {
|
||||
case 2: // payload.proto_payload
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(google_protobuf2.Any)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Payload = &LogEntry_ProtoPayload{msg}
|
||||
return true, err
|
||||
case 3: // payload.text_payload
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.Payload = &LogEntry_TextPayload{x}
|
||||
return true, err
|
||||
case 6: // payload.json_payload
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(google_protobuf3.Struct)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Payload = &LogEntry_JsonPayload{msg}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _LogEntry_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*LogEntry)
|
||||
// payload
|
||||
switch x := m.Payload.(type) {
|
||||
case *LogEntry_ProtoPayload:
|
||||
s := proto.Size(x.ProtoPayload)
|
||||
n += proto.SizeVarint(2<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *LogEntry_TextPayload:
|
||||
n += proto.SizeVarint(3<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(len(x.TextPayload)))
|
||||
n += len(x.TextPayload)
|
||||
case *LogEntry_JsonPayload:
|
||||
s := proto.Size(x.JsonPayload)
|
||||
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
|
||||
}
|
||||
|
||||
// Additional information about a potentially long-running operation with which
|
||||
// a log entry is associated.
|
||||
type LogEntryOperation struct {
|
||||
// Optional. An arbitrary operation identifier. Log entries with the
|
||||
// same identifier are assumed to be part of the same operation.
|
||||
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
|
||||
// Optional. An arbitrary producer identifier. The combination of
|
||||
// `id` and `producer` must be globally unique. Examples for `producer`:
|
||||
// `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`.
|
||||
Producer string `protobuf:"bytes,2,opt,name=producer" json:"producer,omitempty"`
|
||||
// Optional. Set this to True if this is the first log entry in the operation.
|
||||
First bool `protobuf:"varint,3,opt,name=first" json:"first,omitempty"`
|
||||
// Optional. Set this to True if this is the last log entry in the operation.
|
||||
Last bool `protobuf:"varint,4,opt,name=last" json:"last,omitempty"`
|
||||
}
|
||||
|
||||
func (m *LogEntryOperation) Reset() { *m = LogEntryOperation{} }
|
||||
func (m *LogEntryOperation) String() string { return proto.CompactTextString(m) }
|
||||
func (*LogEntryOperation) ProtoMessage() {}
|
||||
func (*LogEntryOperation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*LogEntry)(nil), "google.logging.v2.LogEntry")
|
||||
proto.RegisterType((*LogEntryOperation)(nil), "google.logging.v2.LogEntryOperation")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/logging/v2/log_entry.proto", fileDescriptor0)
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 617 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x54, 0x5f, 0x6f, 0xd3, 0x3e,
|
||||
0x14, 0xfd, 0x65, 0xff, 0x9a, 0xb8, 0xdd, 0x7e, 0xcc, 0x1a, 0x22, 0x04, 0x21, 0x55, 0x03, 0x09,
|
||||
0x9e, 0x1c, 0x54, 0x84, 0xb4, 0x31, 0x24, 0xa0, 0x68, 0xd2, 0x26, 0x0d, 0x36, 0x79, 0x3c, 0x21,
|
||||
0xa1, 0x2a, 0x4d, 0x5d, 0xd7, 0x90, 0xda, 0xc1, 0x71, 0x2a, 0xf2, 0x81, 0xf8, 0x8e, 0x3c, 0x62,
|
||||
0x3b, 0x4e, 0x3a, 0x51, 0xc4, 0x36, 0xf1, 0xd0, 0xf6, 0x5e, 0xfb, 0x9c, 0x73, 0x7d, 0xcf, 0xb5,
|
||||
0x0b, 0xde, 0x50, 0x21, 0x68, 0x46, 0x10, 0x15, 0x59, 0xc2, 0x29, 0x12, 0x92, 0xc6, 0x94, 0xf0,
|
||||
0x5c, 0x0a, 0x25, 0xe2, 0x7a, 0x2b, 0xc9, 0x59, 0x11, 0x67, 0x82, 0x52, 0xc6, 0x69, 0xbc, 0x18,
|
||||
0x98, 0x70, 0x44, 0xb8, 0x92, 0x15, 0xb2, 0x28, 0xb8, 0xeb, 0x14, 0x1c, 0x04, 0x2d, 0x06, 0xd1,
|
||||
0xe9, 0xcd, 0x44, 0xf5, 0x57, 0x5c, 0x10, 0xb9, 0x60, 0x29, 0x49, 0x05, 0x9f, 0x32, 0x1a, 0x27,
|
||||
0x9c, 0x0b, 0x95, 0x28, 0x26, 0x78, 0x51, 0xab, 0x47, 0xe7, 0x37, 0x97, 0x9a, 0x0b, 0xce, 0x94,
|
||||
0x90, 0x64, 0x22, 0x49, 0xb1, 0x4c, 0x46, 0x3a, 0x13, 0xa5, 0x4c, 0x89, 0x13, 0x3c, 0xbe, 0x5d,
|
||||
0xc3, 0xaa, 0xca, 0x49, 0x3c, 0x53, 0x2a, 0xd7, 0x3a, 0xdf, 0x4a, 0x52, 0xa8, 0x7f, 0x90, 0x31,
|
||||
0xce, 0x15, 0x64, 0x41, 0x24, 0x53, 0xce, 0xbc, 0x28, 0xa6, 0x4c, 0xcd, 0xca, 0x31, 0x4a, 0xc5,
|
||||
0x3c, 0xae, 0xa5, 0x62, 0xbb, 0x31, 0x2e, 0xa7, 0x71, 0x6e, 0x48, 0xba, 0x35, 0x5e, 0x99, 0x8f,
|
||||
0x23, 0xbc, 0xb8, 0x9e, 0x50, 0x28, 0x59, 0xa6, 0xca, 0xfd, 0x38, 0xda, 0xd1, 0xf5, 0x34, 0xc5,
|
||||
0xe6, 0xba, 0xbd, 0x64, 0x9e, 0x2f, 0xa3, 0x9a, 0xbc, 0xff, 0x63, 0x13, 0xf8, 0x67, 0x82, 0x1e,
|
||||
0x9b, 0xa1, 0xc3, 0xfb, 0xc0, 0x37, 0x7d, 0xf0, 0x64, 0x4e, 0xc2, 0x5e, 0xdf, 0x7b, 0x1a, 0xe0,
|
||||
0x8e, 0xce, 0x3f, 0xe8, 0x14, 0x1e, 0x02, 0xbf, 0x31, 0x3b, 0xf4, 0xf5, 0x56, 0x77, 0xf0, 0x10,
|
||||
0x39, 0x9b, 0xb4, 0x19, 0xe8, 0x7d, 0x33, 0x12, 0xec, 0x40, 0xb8, 0x85, 0xc3, 0x23, 0xb0, 0x6d,
|
||||
0x6b, 0x8d, 0xf2, 0xa4, 0xca, 0x44, 0x32, 0x09, 0xd7, 0x2c, 0x7f, 0xaf, 0xe1, 0x37, 0x87, 0x45,
|
||||
0x6f, 0x79, 0x75, 0xf2, 0x1f, 0xee, 0xd9, 0xfc, 0xa2, 0xc6, 0xc2, 0x47, 0xa0, 0xa7, 0xc8, 0x77,
|
||||
0xd5, 0x72, 0xd7, 0xcd, 0xb1, 0x34, 0xaa, 0x6b, 0x56, 0x1b, 0xd0, 0x2b, 0xd0, 0xfb, 0x52, 0x08,
|
||||
0xde, 0x82, 0xb6, 0x6c, 0x81, 0x7b, 0x2b, 0x05, 0x2e, 0xad, 0x6d, 0x86, 0x6d, 0xe0, 0x0d, 0xfb,
|
||||
0x00, 0x04, 0xad, 0x2b, 0x61, 0x60, 0xa9, 0xd1, 0x0a, 0xf5, 0x63, 0x83, 0xc0, 0x4b, 0xb0, 0xae,
|
||||
0xeb, 0x37, 0x33, 0x0f, 0x81, 0x26, 0xee, 0x0c, 0xfa, 0xe8, 0xb7, 0x17, 0x63, 0xfc, 0x47, 0xda,
|
||||
0xe0, 0x4b, 0x87, 0xc3, 0x2d, 0x03, 0x3e, 0x00, 0x01, 0xe3, 0xfa, 0x8d, 0xa8, 0x11, 0x9b, 0x84,
|
||||
0x1b, 0xd6, 0x6e, 0xbf, 0x5e, 0x38, 0x9d, 0xc0, 0x77, 0xa0, 0x77, 0xf5, 0x66, 0x86, 0x1d, 0x7b,
|
||||
0xae, 0x3f, 0xcb, 0x9f, 0x68, 0x20, 0xae, 0x71, 0xb8, 0x3b, 0x5b, 0x26, 0xf0, 0x35, 0xd8, 0xca,
|
||||
0x92, 0x31, 0xc9, 0x8a, 0xb0, 0xdb, 0x5f, 0xd7, 0xf4, 0x27, 0x68, 0xe5, 0x3d, 0xa3, 0x66, 0xf8,
|
||||
0xe8, 0xcc, 0x22, 0x6d, 0x8c, 0x1d, 0x0d, 0x0e, 0x41, 0x20, 0x72, 0x22, 0xed, 0xab, 0x0d, 0xff,
|
||||
0xb7, 0x47, 0x78, 0xfc, 0x17, 0x8d, 0xf3, 0x06, 0x8b, 0x97, 0xb4, 0xe8, 0x10, 0x74, 0xaf, 0x48,
|
||||
0xc3, 0x3b, 0x60, 0xfd, 0x2b, 0xa9, 0x42, 0xcf, 0xf6, 0x6b, 0x42, 0xb8, 0x07, 0x36, 0x17, 0x49,
|
||||
0x56, 0x12, 0x7b, 0x2f, 0x02, 0x5c, 0x27, 0x2f, 0xd7, 0x0e, 0xbc, 0x61, 0x00, 0x3a, 0x6e, 0xa4,
|
||||
0xfb, 0x0c, 0xec, 0xae, 0x54, 0x81, 0x3b, 0x60, 0x4d, 0x5b, 0x57, 0x4b, 0xe9, 0x08, 0x46, 0xc0,
|
||||
0xd7, 0x03, 0x9b, 0x94, 0x29, 0x91, 0x4e, 0xac, 0xcd, 0x4d, 0x95, 0x29, 0x93, 0xda, 0x49, 0x73,
|
||||
0x83, 0x7c, 0x5c, 0x27, 0x10, 0x82, 0x8d, 0x2c, 0xd1, 0x8b, 0x1b, 0x76, 0xd1, 0xc6, 0xc3, 0xcf,
|
||||
0xe0, 0xae, 0x7e, 0x4a, 0xab, 0x6d, 0x0e, 0xb7, 0x9b, 0x13, 0x5c, 0xd8, 0x1b, 0xea, 0x7d, 0x7a,
|
||||
0x76, 0xdb, 0x3f, 0xd8, 0x9f, 0x9e, 0x37, 0xde, 0xb2, 0xfb, 0xcf, 0x7f, 0x05, 0x00, 0x00, 0xff,
|
||||
0xff, 0x1e, 0x4b, 0x59, 0x17, 0x9e, 0x05, 0x00, 0x00,
|
||||
}
|
||||
Generated
Vendored
+115
@@ -0,0 +1,115 @@
|
||||
// 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.v2;
|
||||
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto"; // from google/api/annotations.proto
|
||||
import "google.golang.org/genproto/googleapis/api/monitoredres/monitored_resource.proto"; // from google/api/monitored_resource.proto
|
||||
import "google.golang.org/genproto/googleapis/logging/type/http_request.proto"; // from google/logging/type/http_request.proto
|
||||
import "google.golang.org/genproto/googleapis/logging/type/log_severity.proto"; // from google/logging/type/log_severity.proto
|
||||
import "github.com/golang/protobuf/ptypes/any/any.proto"; // from google/protobuf/any.proto
|
||||
import "github.com/golang/protobuf/ptypes/struct/struct.proto"; // from google/protobuf/struct.proto
|
||||
import "github.com/golang/protobuf/ptypes/timestamp/timestamp.proto"; // from google/protobuf/timestamp.proto
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "LogEntryProto";
|
||||
option java_package = "com.google.logging.v2";
|
||||
|
||||
option go_package = "google.golang.org/genproto/googleapis/logging/v2";
|
||||
|
||||
// An individual entry in a log.
|
||||
message LogEntry {
|
||||
// Required. The resource name of the log to which this log entry
|
||||
// belongs. The format of the name is
|
||||
// `"projects/<project-id>/logs/<log-id>"`. Examples:
|
||||
// `"projects/my-projectid/logs/syslog"`,
|
||||
// `"projects/my-projectid/logs/library.googleapis.com%2Fbook_log"`.
|
||||
//
|
||||
// The log ID part of resource name 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.
|
||||
// Forward-slash (`/`) characters in the log ID must be URL-encoded.
|
||||
string log_name = 12;
|
||||
|
||||
// Required. The monitored resource associated with this log entry.
|
||||
// Example: a log entry that reports a database error would be
|
||||
// associated with the monitored resource designating the particular
|
||||
// database that reported the error.
|
||||
google.api.MonitoredResource resource = 8;
|
||||
|
||||
// Optional. The log entry payload, which can be one of multiple types.
|
||||
oneof payload {
|
||||
// The log entry payload, represented as a protocol buffer. Some
|
||||
// Google Cloud Platform services use this field for their log
|
||||
// entry payloads.
|
||||
google.protobuf.Any proto_payload = 2;
|
||||
|
||||
// The log entry payload, represented as a Unicode string (UTF-8).
|
||||
string text_payload = 3;
|
||||
|
||||
// The log entry payload, represented as a structure that
|
||||
// is expressed as a JSON object.
|
||||
google.protobuf.Struct json_payload = 6;
|
||||
}
|
||||
|
||||
// Optional. The time the event described by the log entry occurred. If
|
||||
// omitted, Stackdriver Logging will use the time the log entry is received.
|
||||
google.protobuf.Timestamp timestamp = 9;
|
||||
|
||||
// Optional. The severity of the log entry. The default value is
|
||||
// `LogSeverity.DEFAULT`.
|
||||
google.logging.type.LogSeverity severity = 10;
|
||||
|
||||
// Optional. A unique ID for the log entry. If you provide this
|
||||
// field, the logging service considers other log entries in the
|
||||
// same project with the same ID as duplicates which can be removed. If
|
||||
// omitted, Stackdriver Logging will generate a unique ID for this
|
||||
// log entry.
|
||||
string insert_id = 4;
|
||||
|
||||
// Optional. Information about the HTTP request associated with this
|
||||
// log entry, if applicable.
|
||||
google.logging.type.HttpRequest http_request = 7;
|
||||
|
||||
// Optional. A set of user-defined (key, value) data that provides additional
|
||||
// information about the log entry.
|
||||
map<string, string> labels = 11;
|
||||
|
||||
// Optional. Information about an operation associated with the log entry, if
|
||||
// applicable.
|
||||
LogEntryOperation operation = 15;
|
||||
}
|
||||
|
||||
// Additional information about a potentially long-running operation with which
|
||||
// a log entry is associated.
|
||||
message LogEntryOperation {
|
||||
// Optional. An arbitrary operation identifier. Log entries with the
|
||||
// same identifier are assumed to be part of the same operation.
|
||||
string id = 1;
|
||||
|
||||
// Optional. An arbitrary producer identifier. The combination of
|
||||
// `id` and `producer` must be globally unique. Examples for `producer`:
|
||||
// `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`.
|
||||
string producer = 2;
|
||||
|
||||
// Optional. Set this to True if this is the first log entry in the operation.
|
||||
bool first = 3;
|
||||
|
||||
// Optional. Set this to True if this is the last log entry in the operation.
|
||||
bool last = 4;
|
||||
}
|
||||
Generated
Vendored
+479
@@ -0,0 +1,479 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/logging/v2/logging.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package v2 // import "google.golang.org/genproto/googleapis/logging/v2"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
import google_api3 "google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
import _ "github.com/golang/protobuf/ptypes/duration"
|
||||
import google_protobuf5 "github.com/golang/protobuf/ptypes/empty"
|
||||
import _ "github.com/golang/protobuf/ptypes/timestamp"
|
||||
import _ "google.golang.org/genproto/googleapis/rpc/status"
|
||||
|
||||
import (
|
||||
context "golang.org/x/net/context"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// The parameters to DeleteLog.
|
||||
type DeleteLogRequest struct {
|
||||
// Required. The resource name of the log to delete. Example:
|
||||
// `"projects/my-project/logs/syslog"`.
|
||||
LogName string `protobuf:"bytes,1,opt,name=log_name,json=logName" json:"log_name,omitempty"`
|
||||
}
|
||||
|
||||
func (m *DeleteLogRequest) Reset() { *m = DeleteLogRequest{} }
|
||||
func (m *DeleteLogRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*DeleteLogRequest) ProtoMessage() {}
|
||||
func (*DeleteLogRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
|
||||
|
||||
// The parameters to WriteLogEntries.
|
||||
type WriteLogEntriesRequest struct {
|
||||
// Optional. A default log resource name that is assigned to all log entries
|
||||
// in `entries` that do not specify a value for `log_name`. Example:
|
||||
// `"projects/my-project/logs/syslog"`. See
|
||||
// [LogEntry][google.logging.v2.LogEntry].
|
||||
LogName string `protobuf:"bytes,1,opt,name=log_name,json=logName" json:"log_name,omitempty"`
|
||||
// Optional. A default monitored resource object that is assigned to all log
|
||||
// entries in `entries` that do not specify a value for `resource`. Example:
|
||||
//
|
||||
// { "type": "gce_instance",
|
||||
// "labels": {
|
||||
// "zone": "us-central1-a", "instance_id": "00000000000000000000" }}
|
||||
//
|
||||
// See [LogEntry][google.logging.v2.LogEntry].
|
||||
Resource *google_api3.MonitoredResource `protobuf:"bytes,2,opt,name=resource" json:"resource,omitempty"`
|
||||
// Optional. Default labels that are added to the `labels` field of all log
|
||||
// entries in `entries`. If a log entry already has a label with the same key
|
||||
// as a label in this parameter, then the log entry's label is not changed.
|
||||
// See [LogEntry][google.logging.v2.LogEntry].
|
||||
Labels map[string]string `protobuf:"bytes,3,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
// Required. The log entries to write. Values supplied for the fields
|
||||
// `log_name`, `resource`, and `labels` in this `entries.write` request are
|
||||
// added to those log entries that do not provide their own values for the
|
||||
// fields.
|
||||
//
|
||||
// To improve throughput and to avoid exceeding the
|
||||
// [quota limit](/logging/quota-policy) for calls to `entries.write`,
|
||||
// you should write multiple log entries at once rather than
|
||||
// calling this method for each individual log entry.
|
||||
Entries []*LogEntry `protobuf:"bytes,4,rep,name=entries" json:"entries,omitempty"`
|
||||
// Optional. Whether valid entries should be written even if some other
|
||||
// entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any
|
||||
// entry is not written, the response status will be the error associated
|
||||
// with one of the failed entries and include error details in the form of
|
||||
// WriteLogEntriesPartialErrors.
|
||||
PartialSuccess bool `protobuf:"varint,5,opt,name=partial_success,json=partialSuccess" json:"partial_success,omitempty"`
|
||||
}
|
||||
|
||||
func (m *WriteLogEntriesRequest) Reset() { *m = WriteLogEntriesRequest{} }
|
||||
func (m *WriteLogEntriesRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*WriteLogEntriesRequest) ProtoMessage() {}
|
||||
func (*WriteLogEntriesRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} }
|
||||
|
||||
func (m *WriteLogEntriesRequest) GetResource() *google_api3.MonitoredResource {
|
||||
if m != nil {
|
||||
return m.Resource
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *WriteLogEntriesRequest) GetLabels() map[string]string {
|
||||
if m != nil {
|
||||
return m.Labels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *WriteLogEntriesRequest) GetEntries() []*LogEntry {
|
||||
if m != nil {
|
||||
return m.Entries
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Result returned from WriteLogEntries.
|
||||
// empty
|
||||
type WriteLogEntriesResponse struct {
|
||||
}
|
||||
|
||||
func (m *WriteLogEntriesResponse) Reset() { *m = WriteLogEntriesResponse{} }
|
||||
func (m *WriteLogEntriesResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*WriteLogEntriesResponse) ProtoMessage() {}
|
||||
func (*WriteLogEntriesResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} }
|
||||
|
||||
// The parameters to `ListLogEntries`.
|
||||
type ListLogEntriesRequest struct {
|
||||
// Deprecated. One or more project identifiers or project numbers from which
|
||||
// to retrieve log entries. Examples: `"my-project-1A"`, `"1234567890"`. If
|
||||
// present, these project identifiers are converted to resource format and
|
||||
// added to the list of resources in `resourceNames`. Callers should use
|
||||
// `resourceNames` rather than this parameter.
|
||||
ProjectIds []string `protobuf:"bytes,1,rep,name=project_ids,json=projectIds" json:"project_ids,omitempty"`
|
||||
// Optional. One or more cloud resources from which to retrieve log entries.
|
||||
// Example: `"projects/my-project-1A"`, `"projects/1234567890"`. Projects
|
||||
// listed in `projectIds` are added to this list.
|
||||
ResourceNames []string `protobuf:"bytes,8,rep,name=resource_names,json=resourceNames" json:"resource_names,omitempty"`
|
||||
// Optional. A filter that chooses which log entries to return. See [Advanced
|
||||
// Logs Filters](/logging/docs/view/advanced_filters). Only log entries that
|
||||
// match the filter are returned. An empty filter matches all log entries.
|
||||
Filter string `protobuf:"bytes,2,opt,name=filter" json:"filter,omitempty"`
|
||||
// Optional. How the results should be sorted. Presently, the only permitted
|
||||
// values are `"timestamp asc"` (default) and `"timestamp desc"`. The first
|
||||
// option returns entries in order of increasing values of
|
||||
// `LogEntry.timestamp` (oldest first), and the second option returns entries
|
||||
// in order of decreasing timestamps (newest first). Entries with equal
|
||||
// timestamps are returned in order of `LogEntry.insertId`.
|
||||
OrderBy string `protobuf:"bytes,3,opt,name=order_by,json=orderBy" json:"order_by,omitempty"`
|
||||
// Optional. The maximum number of results to return from this request.
|
||||
// Non-positive values are ignored. The presence of `nextPageToken` in the
|
||||
// response indicates that more results might be available.
|
||||
PageSize int32 `protobuf:"varint,4,opt,name=page_size,json=pageSize" json:"page_size,omitempty"`
|
||||
// Optional. If present, then retrieve the next batch of results from the
|
||||
// preceding call to this method. `pageToken` must be the value of
|
||||
// `nextPageToken` from the previous response. The values of other method
|
||||
// parameters should be identical to those in the previous call.
|
||||
PageToken string `protobuf:"bytes,5,opt,name=page_token,json=pageToken" json:"page_token,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ListLogEntriesRequest) Reset() { *m = ListLogEntriesRequest{} }
|
||||
func (m *ListLogEntriesRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListLogEntriesRequest) ProtoMessage() {}
|
||||
func (*ListLogEntriesRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} }
|
||||
|
||||
// Result returned from `ListLogEntries`.
|
||||
type ListLogEntriesResponse struct {
|
||||
// A list of log entries.
|
||||
Entries []*LogEntry `protobuf:"bytes,1,rep,name=entries" json:"entries,omitempty"`
|
||||
// If there might be more results than appear in this response, then
|
||||
// `nextPageToken` is included. To get the next set of results, call this
|
||||
// method again using the value of `nextPageToken` as `pageToken`.
|
||||
NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken" json:"next_page_token,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ListLogEntriesResponse) Reset() { *m = ListLogEntriesResponse{} }
|
||||
func (m *ListLogEntriesResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListLogEntriesResponse) ProtoMessage() {}
|
||||
func (*ListLogEntriesResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{4} }
|
||||
|
||||
func (m *ListLogEntriesResponse) GetEntries() []*LogEntry {
|
||||
if m != nil {
|
||||
return m.Entries
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// The parameters to ListMonitoredResourceDescriptors
|
||||
type ListMonitoredResourceDescriptorsRequest struct {
|
||||
// Optional. The maximum number of results to return from this request.
|
||||
// Non-positive values are ignored. The presence of `nextPageToken` in the
|
||||
// response indicates that more results might be available.
|
||||
PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize" json:"page_size,omitempty"`
|
||||
// Optional. If present, then retrieve the next batch of results from the
|
||||
// preceding call to this method. `pageToken` must be the value of
|
||||
// `nextPageToken` from the previous response. The values of other method
|
||||
// parameters should be identical to those in the previous call.
|
||||
PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken" json:"page_token,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ListMonitoredResourceDescriptorsRequest) Reset() {
|
||||
*m = ListMonitoredResourceDescriptorsRequest{}
|
||||
}
|
||||
func (m *ListMonitoredResourceDescriptorsRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListMonitoredResourceDescriptorsRequest) ProtoMessage() {}
|
||||
func (*ListMonitoredResourceDescriptorsRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor1, []int{5}
|
||||
}
|
||||
|
||||
// Result returned from ListMonitoredResourceDescriptors.
|
||||
type ListMonitoredResourceDescriptorsResponse struct {
|
||||
// A list of resource descriptors.
|
||||
ResourceDescriptors []*google_api3.MonitoredResourceDescriptor `protobuf:"bytes,1,rep,name=resource_descriptors,json=resourceDescriptors" json:"resource_descriptors,omitempty"`
|
||||
// If there might be more results than appear in this response, then
|
||||
// `nextPageToken` is included. To get the next set of results, call this
|
||||
// method again using the value of `nextPageToken` as `pageToken`.
|
||||
NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken" json:"next_page_token,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ListMonitoredResourceDescriptorsResponse) Reset() {
|
||||
*m = ListMonitoredResourceDescriptorsResponse{}
|
||||
}
|
||||
func (m *ListMonitoredResourceDescriptorsResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListMonitoredResourceDescriptorsResponse) ProtoMessage() {}
|
||||
func (*ListMonitoredResourceDescriptorsResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor1, []int{6}
|
||||
}
|
||||
|
||||
func (m *ListMonitoredResourceDescriptorsResponse) GetResourceDescriptors() []*google_api3.MonitoredResourceDescriptor {
|
||||
if m != nil {
|
||||
return m.ResourceDescriptors
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*DeleteLogRequest)(nil), "google.logging.v2.DeleteLogRequest")
|
||||
proto.RegisterType((*WriteLogEntriesRequest)(nil), "google.logging.v2.WriteLogEntriesRequest")
|
||||
proto.RegisterType((*WriteLogEntriesResponse)(nil), "google.logging.v2.WriteLogEntriesResponse")
|
||||
proto.RegisterType((*ListLogEntriesRequest)(nil), "google.logging.v2.ListLogEntriesRequest")
|
||||
proto.RegisterType((*ListLogEntriesResponse)(nil), "google.logging.v2.ListLogEntriesResponse")
|
||||
proto.RegisterType((*ListMonitoredResourceDescriptorsRequest)(nil), "google.logging.v2.ListMonitoredResourceDescriptorsRequest")
|
||||
proto.RegisterType((*ListMonitoredResourceDescriptorsResponse)(nil), "google.logging.v2.ListMonitoredResourceDescriptorsResponse")
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion3
|
||||
|
||||
// Client API for LoggingServiceV2 service
|
||||
|
||||
type LoggingServiceV2Client interface {
|
||||
// Deletes a log and all its log entries.
|
||||
// The log will reappear if it receives new entries.
|
||||
DeleteLog(ctx context.Context, in *DeleteLogRequest, opts ...grpc.CallOption) (*google_protobuf5.Empty, error)
|
||||
// Writes log entries to Stackdriver Logging. All log entries are
|
||||
// written by this method.
|
||||
WriteLogEntries(ctx context.Context, in *WriteLogEntriesRequest, opts ...grpc.CallOption) (*WriteLogEntriesResponse, error)
|
||||
// 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).
|
||||
ListLogEntries(ctx context.Context, in *ListLogEntriesRequest, opts ...grpc.CallOption) (*ListLogEntriesResponse, error)
|
||||
// Lists the monitored resource descriptors used by Stackdriver Logging.
|
||||
ListMonitoredResourceDescriptors(ctx context.Context, in *ListMonitoredResourceDescriptorsRequest, opts ...grpc.CallOption) (*ListMonitoredResourceDescriptorsResponse, error)
|
||||
}
|
||||
|
||||
type loggingServiceV2Client struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewLoggingServiceV2Client(cc *grpc.ClientConn) LoggingServiceV2Client {
|
||||
return &loggingServiceV2Client{cc}
|
||||
}
|
||||
|
||||
func (c *loggingServiceV2Client) DeleteLog(ctx context.Context, in *DeleteLogRequest, opts ...grpc.CallOption) (*google_protobuf5.Empty, error) {
|
||||
out := new(google_protobuf5.Empty)
|
||||
err := grpc.Invoke(ctx, "/google.logging.v2.LoggingServiceV2/DeleteLog", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *loggingServiceV2Client) WriteLogEntries(ctx context.Context, in *WriteLogEntriesRequest, opts ...grpc.CallOption) (*WriteLogEntriesResponse, error) {
|
||||
out := new(WriteLogEntriesResponse)
|
||||
err := grpc.Invoke(ctx, "/google.logging.v2.LoggingServiceV2/WriteLogEntries", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *loggingServiceV2Client) ListLogEntries(ctx context.Context, in *ListLogEntriesRequest, opts ...grpc.CallOption) (*ListLogEntriesResponse, error) {
|
||||
out := new(ListLogEntriesResponse)
|
||||
err := grpc.Invoke(ctx, "/google.logging.v2.LoggingServiceV2/ListLogEntries", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *loggingServiceV2Client) ListMonitoredResourceDescriptors(ctx context.Context, in *ListMonitoredResourceDescriptorsRequest, opts ...grpc.CallOption) (*ListMonitoredResourceDescriptorsResponse, error) {
|
||||
out := new(ListMonitoredResourceDescriptorsResponse)
|
||||
err := grpc.Invoke(ctx, "/google.logging.v2.LoggingServiceV2/ListMonitoredResourceDescriptors", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for LoggingServiceV2 service
|
||||
|
||||
type LoggingServiceV2Server interface {
|
||||
// Deletes a log and all its log entries.
|
||||
// The log will reappear if it receives new entries.
|
||||
DeleteLog(context.Context, *DeleteLogRequest) (*google_protobuf5.Empty, error)
|
||||
// Writes log entries to Stackdriver Logging. All log entries are
|
||||
// written by this method.
|
||||
WriteLogEntries(context.Context, *WriteLogEntriesRequest) (*WriteLogEntriesResponse, error)
|
||||
// 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).
|
||||
ListLogEntries(context.Context, *ListLogEntriesRequest) (*ListLogEntriesResponse, error)
|
||||
// Lists the monitored resource descriptors used by Stackdriver Logging.
|
||||
ListMonitoredResourceDescriptors(context.Context, *ListMonitoredResourceDescriptorsRequest) (*ListMonitoredResourceDescriptorsResponse, error)
|
||||
}
|
||||
|
||||
func RegisterLoggingServiceV2Server(s *grpc.Server, srv LoggingServiceV2Server) {
|
||||
s.RegisterService(&_LoggingServiceV2_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _LoggingServiceV2_DeleteLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteLogRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(LoggingServiceV2Server).DeleteLog(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.logging.v2.LoggingServiceV2/DeleteLog",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(LoggingServiceV2Server).DeleteLog(ctx, req.(*DeleteLogRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _LoggingServiceV2_WriteLogEntries_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(WriteLogEntriesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(LoggingServiceV2Server).WriteLogEntries(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.logging.v2.LoggingServiceV2/WriteLogEntries",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(LoggingServiceV2Server).WriteLogEntries(ctx, req.(*WriteLogEntriesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _LoggingServiceV2_ListLogEntries_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListLogEntriesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(LoggingServiceV2Server).ListLogEntries(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.logging.v2.LoggingServiceV2/ListLogEntries",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(LoggingServiceV2Server).ListLogEntries(ctx, req.(*ListLogEntriesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _LoggingServiceV2_ListMonitoredResourceDescriptors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListMonitoredResourceDescriptorsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(LoggingServiceV2Server).ListMonitoredResourceDescriptors(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.logging.v2.LoggingServiceV2/ListMonitoredResourceDescriptors",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(LoggingServiceV2Server).ListMonitoredResourceDescriptors(ctx, req.(*ListMonitoredResourceDescriptorsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _LoggingServiceV2_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "google.logging.v2.LoggingServiceV2",
|
||||
HandlerType: (*LoggingServiceV2Server)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "DeleteLog",
|
||||
Handler: _LoggingServiceV2_DeleteLog_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "WriteLogEntries",
|
||||
Handler: _LoggingServiceV2_WriteLogEntries_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListLogEntries",
|
||||
Handler: _LoggingServiceV2_ListLogEntries_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListMonitoredResourceDescriptors",
|
||||
Handler: _LoggingServiceV2_ListMonitoredResourceDescriptors_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: fileDescriptor1,
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/logging/v2/logging.proto", fileDescriptor1)
|
||||
}
|
||||
|
||||
var fileDescriptor1 = []byte{
|
||||
// 846 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x55, 0x41, 0x6f, 0xeb, 0x44,
|
||||
0x10, 0x96, 0x93, 0xd7, 0xbe, 0x64, 0xcb, 0x6b, 0xf3, 0x96, 0xd7, 0x90, 0x97, 0xf2, 0x44, 0x64,
|
||||
0x54, 0x92, 0x46, 0xaa, 0x0d, 0xa9, 0x2a, 0xd1, 0x54, 0x45, 0xa8, 0x6a, 0x0f, 0x95, 0x52, 0xa8,
|
||||
0x5c, 0x04, 0x52, 0x85, 0x14, 0x39, 0xce, 0xd6, 0x2c, 0x75, 0xbc, 0x66, 0x77, 0x9d, 0x12, 0x10,
|
||||
0x97, 0x1e, 0xf8, 0x03, 0xfc, 0x0f, 0xfe, 0x05, 0x57, 0x2e, 0x5c, 0xb8, 0x22, 0xf1, 0x23, 0x38,
|
||||
0xb2, 0xbb, 0x5e, 0x27, 0x69, 0x92, 0xd7, 0xb8, 0xbd, 0x24, 0x3b, 0xb3, 0x33, 0xdf, 0xcc, 0x37,
|
||||
0x33, 0x3b, 0x06, 0x9f, 0xf9, 0x84, 0xf8, 0x01, 0xb2, 0x7c, 0x12, 0xb8, 0xa1, 0x6f, 0x11, 0xea,
|
||||
0xdb, 0x3e, 0x0a, 0x23, 0x4a, 0x38, 0xb1, 0x93, 0x2b, 0x37, 0xc2, 0xcc, 0x0e, 0x88, 0xef, 0xe3,
|
||||
0xd0, 0xb7, 0x87, 0xad, 0xf4, 0x68, 0x29, 0x1b, 0xf8, 0x52, 0xfb, 0xa7, 0xda, 0x61, 0xab, 0x7a,
|
||||
0x96, 0x0d, 0x52, 0xfc, 0xd8, 0x0c, 0xd1, 0x21, 0xf6, 0x90, 0x47, 0xc2, 0x6b, 0xec, 0xdb, 0x6e,
|
||||
0x18, 0x12, 0xee, 0x72, 0x4c, 0x42, 0x96, 0xa0, 0x57, 0xbf, 0xcc, 0x0e, 0x35, 0x20, 0x21, 0xe6,
|
||||
0x84, 0xa2, 0x3e, 0x45, 0x6c, 0x22, 0x74, 0x85, 0x44, 0x62, 0xea, 0x21, 0x0d, 0xf8, 0xf9, 0x53,
|
||||
0xe8, 0x76, 0x51, 0xc8, 0xe9, 0x48, 0x23, 0x1c, 0xf8, 0x98, 0x7f, 0x17, 0xf7, 0x2c, 0x8f, 0x0c,
|
||||
0xec, 0x04, 0xc5, 0x56, 0x17, 0xbd, 0xf8, 0xda, 0x8e, 0xf8, 0x28, 0x12, 0xd1, 0xfb, 0x31, 0x55,
|
||||
0x2c, 0xc6, 0x07, 0xed, 0xba, 0xb7, 0xdc, 0x15, 0x0d, 0xc4, 0x21, 0xf9, 0xd5, 0x4e, 0x87, 0xcb,
|
||||
0x9d, 0x38, 0x1e, 0x20, 0xc6, 0xdd, 0x41, 0x34, 0x39, 0x69, 0xe7, 0xa3, 0x6c, 0x74, 0x69, 0xe4,
|
||||
0xd9, 0xc2, 0x8d, 0xc7, 0x4c, 0xff, 0x25, 0xee, 0xe6, 0x2e, 0x28, 0x9d, 0xa0, 0x00, 0x71, 0xd4,
|
||||
0x21, 0xbe, 0x83, 0x7e, 0x88, 0x05, 0x36, 0x7c, 0x0d, 0x0a, 0xb2, 0x24, 0xa1, 0x3b, 0x40, 0x15,
|
||||
0xa3, 0x66, 0x34, 0x8a, 0xce, 0x73, 0x21, 0x7f, 0x21, 0x44, 0xf3, 0xef, 0x1c, 0x28, 0x7f, 0x43,
|
||||
0xb1, 0x32, 0x3f, 0x15, 0x25, 0xc3, 0x88, 0x2d, 0xf7, 0x82, 0x07, 0xa0, 0x90, 0x36, 0xa9, 0x92,
|
||||
0x13, 0x57, 0x6b, 0xad, 0x37, 0x96, 0x4e, 0x5b, 0x24, 0x67, 0x9d, 0xa7, 0xad, 0x74, 0xb4, 0x91,
|
||||
0x33, 0x36, 0x87, 0xe7, 0x60, 0x35, 0x70, 0x7b, 0x28, 0x60, 0x95, 0x7c, 0x2d, 0x2f, 0x1c, 0xf7,
|
||||
0xad, 0xb9, 0x69, 0xb4, 0x16, 0x27, 0x64, 0x75, 0x94, 0x9f, 0x54, 0x8e, 0x1c, 0x0d, 0x02, 0xf7,
|
||||
0xc1, 0x73, 0x94, 0x58, 0x55, 0x9e, 0x29, 0xbc, 0xad, 0x05, 0x78, 0x1a, 0x6a, 0xe4, 0xa4, 0xb6,
|
||||
0xb0, 0x0e, 0x36, 0x22, 0x97, 0x72, 0xec, 0x06, 0x5d, 0x16, 0x7b, 0x1e, 0x62, 0xac, 0xb2, 0x22,
|
||||
0x78, 0x14, 0x9c, 0x75, 0xad, 0xbe, 0x4c, 0xb4, 0xd5, 0x03, 0xb0, 0x36, 0x15, 0x16, 0x96, 0x40,
|
||||
0xfe, 0x06, 0x8d, 0x74, 0x39, 0xe4, 0x11, 0xbe, 0x02, 0x2b, 0x43, 0x37, 0x88, 0x93, 0x3a, 0x14,
|
||||
0x9d, 0x44, 0x68, 0xe7, 0x3e, 0x35, 0xcc, 0xd7, 0xe0, 0xbd, 0x39, 0x22, 0x2c, 0x12, 0x0f, 0x05,
|
||||
0x99, 0x7f, 0x1a, 0x60, 0xb3, 0x83, 0x19, 0x9f, 0x2f, 0xfa, 0x07, 0x60, 0x4d, 0xf4, 0xf1, 0x7b,
|
||||
0xe4, 0xf1, 0x2e, 0xee, 0x33, 0x11, 0x28, 0x2f, 0x40, 0x81, 0x56, 0x9d, 0xf5, 0x19, 0xdc, 0x06,
|
||||
0xeb, 0x69, 0x2d, 0x55, 0x6b, 0x58, 0xa5, 0xa0, 0x6c, 0x5e, 0xa4, 0x5a, 0xd9, 0x20, 0x06, 0xcb,
|
||||
0x60, 0xf5, 0x1a, 0x07, 0x1c, 0x51, 0x9d, 0x97, 0x96, 0x64, 0x53, 0x09, 0xed, 0x23, 0xda, 0xed,
|
||||
0x8d, 0x44, 0x03, 0x54, 0x53, 0x95, 0x7c, 0x3c, 0x82, 0x5b, 0xa0, 0x18, 0xb9, 0x3e, 0xea, 0x32,
|
||||
0xfc, 0x13, 0x12, 0xc5, 0x34, 0x1a, 0x2b, 0x4e, 0x41, 0x2a, 0x2e, 0x85, 0x0c, 0xdf, 0x00, 0xa0,
|
||||
0x2e, 0x39, 0xb9, 0x41, 0xa1, 0xaa, 0x55, 0xd1, 0x51, 0xe6, 0x5f, 0x49, 0x85, 0x79, 0x0b, 0xca,
|
||||
0xb3, 0x7c, 0x12, 0xaa, 0xd3, 0x0d, 0x32, 0x1e, 0xd1, 0xa0, 0x8f, 0xc0, 0x46, 0x88, 0x7e, 0xe4,
|
||||
0xdd, 0xa9, 0xa0, 0x09, 0x91, 0x17, 0x52, 0x7d, 0x31, 0x0e, 0x8c, 0x40, 0x5d, 0x06, 0x9e, 0x9b,
|
||||
0xb8, 0x13, 0xc4, 0x3c, 0x8a, 0x23, 0xa1, 0x1b, 0x97, 0xf6, 0x1e, 0x3f, 0xe3, 0x41, 0x7e, 0xb9,
|
||||
0x59, 0x7e, 0xbf, 0x1b, 0xa0, 0xb1, 0x3c, 0x8e, 0xa6, 0x7c, 0x05, 0x5e, 0x8d, 0x5b, 0xd4, 0x9f,
|
||||
0xdc, 0x6b, 0xfe, 0xf5, 0x07, 0x5f, 0xca, 0x04, 0xcf, 0x79, 0x97, 0xce, 0xc7, 0xc8, 0x5a, 0x97,
|
||||
0xd6, 0x3f, 0xcf, 0x40, 0xa9, 0x93, 0x14, 0xf8, 0x32, 0x59, 0xd8, 0x5f, 0xb7, 0xe0, 0x2d, 0x28,
|
||||
0x8e, 0x77, 0x03, 0xfc, 0x70, 0x41, 0x1f, 0x66, 0x37, 0x47, 0xb5, 0x9c, 0x1a, 0xa5, 0xfb, 0xcb,
|
||||
0x3a, 0x95, 0x7b, 0xce, 0xdc, 0xbd, 0xfb, 0xeb, 0xdf, 0xdf, 0x72, 0xf5, 0xe6, 0xb6, 0x58, 0xb7,
|
||||
0x3d, 0xc4, 0xdd, 0x4f, 0xec, 0x9f, 0xd3, 0x5d, 0x71, 0xa4, 0x87, 0x95, 0xd9, 0x4d, 0xb9, 0x88,
|
||||
0xc5, 0xdf, 0x2f, 0xf0, 0x57, 0x03, 0x6c, 0xcc, 0xbc, 0x05, 0xb8, 0x93, 0xf9, 0xe1, 0x57, 0x9b,
|
||||
0x59, 0x4c, 0xf5, 0xd3, 0x7a, 0x5f, 0x65, 0x56, 0x36, 0x5f, 0xca, 0x0f, 0x81, 0x9e, 0xa6, 0xf6,
|
||||
0xad, 0x34, 0x6e, 0x1b, 0x4d, 0x78, 0x67, 0x80, 0xf5, 0xfb, 0x83, 0x0a, 0x1b, 0x8b, 0xe6, 0x71,
|
||||
0xd1, 0xdb, 0xac, 0xee, 0x64, 0xb0, 0xd4, 0x59, 0x6c, 0xa9, 0x2c, 0x36, 0xcd, 0xd2, 0x74, 0x16,
|
||||
0x81, 0xb0, 0x95, 0x49, 0xfc, 0x61, 0x80, 0xda, 0xb2, 0x61, 0x82, 0xed, 0xb7, 0x04, 0xcb, 0x30,
|
||||
0xe9, 0xd5, 0xc3, 0x27, 0xf9, 0xea, 0xd4, 0x1b, 0x2a, 0x75, 0x13, 0xd6, 0x64, 0xea, 0x83, 0x07,
|
||||
0x3c, 0x8e, 0xbf, 0x05, 0x9b, 0xe2, 0x0b, 0x37, 0x1f, 0xeb, 0xf8, 0x1d, 0x3d, 0x79, 0x17, 0x72,
|
||||
0x68, 0x2e, 0x8c, 0xab, 0x8f, 0x1f, 0xfb, 0x05, 0xff, 0xcf, 0x30, 0x7a, 0xab, 0xea, 0x7e, 0xef,
|
||||
0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x21, 0x93, 0x51, 0x60, 0xee, 0x08, 0x00, 0x00,
|
||||
}
|
||||
Generated
Vendored
+190
@@ -0,0 +1,190 @@
|
||||
// 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.v2;
|
||||
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto"; // from google/api/annotations.proto
|
||||
import "google.golang.org/genproto/googleapis/api/monitoredres/monitored_resource.proto"; // from google/api/monitored_resource.proto
|
||||
import "google.golang.org/genproto/googleapis/logging/v2/log_entry.proto"; // from google/logging/v2/log_entry.proto
|
||||
import "github.com/golang/protobuf/ptypes/duration/duration.proto"; // from google/protobuf/duration.proto
|
||||
import "github.com/golang/protobuf/ptypes/empty/empty.proto"; // from google/protobuf/empty.proto
|
||||
import "github.com/golang/protobuf/ptypes/timestamp/timestamp.proto"; // from google/protobuf/timestamp.proto
|
||||
import "google.golang.org/genproto/googleapis/rpc/status/status.proto"; // from google/rpc/status.proto
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "LoggingProto";
|
||||
option java_package = "com.google.logging.v2";
|
||||
|
||||
option go_package = "google.golang.org/genproto/googleapis/logging/v2";
|
||||
|
||||
// Service for ingesting and querying logs.
|
||||
service LoggingServiceV2 {
|
||||
// Deletes a log and all its log entries.
|
||||
// The log will reappear if it receives new entries.
|
||||
rpc DeleteLog(DeleteLogRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = { delete: "/v2beta1/{log_name=projects/*/logs/*}" };
|
||||
}
|
||||
|
||||
// Writes log entries to Stackdriver Logging. All log entries are
|
||||
// written by this method.
|
||||
rpc WriteLogEntries(WriteLogEntriesRequest) returns (WriteLogEntriesResponse) {
|
||||
option (google.api.http) = { post: "/v2/entries:write" body: "*" };
|
||||
}
|
||||
|
||||
// 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).
|
||||
rpc ListLogEntries(ListLogEntriesRequest) returns (ListLogEntriesResponse) {
|
||||
option (google.api.http) = { post: "/v2/entries:list" body: "*" };
|
||||
}
|
||||
|
||||
// Lists the monitored resource descriptors used by Stackdriver Logging.
|
||||
rpc ListMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest) returns (ListMonitoredResourceDescriptorsResponse) {
|
||||
option (google.api.http) = { get: "/v2/monitoredResourceDescriptors" };
|
||||
}
|
||||
}
|
||||
|
||||
// The parameters to DeleteLog.
|
||||
message DeleteLogRequest {
|
||||
// Required. The resource name of the log to delete. Example:
|
||||
// `"projects/my-project/logs/syslog"`.
|
||||
string log_name = 1;
|
||||
}
|
||||
|
||||
// The parameters to WriteLogEntries.
|
||||
message WriteLogEntriesRequest {
|
||||
// Optional. A default log resource name that is assigned to all log entries
|
||||
// in `entries` that do not specify a value for `log_name`. Example:
|
||||
// `"projects/my-project/logs/syslog"`. See
|
||||
// [LogEntry][google.logging.v2.LogEntry].
|
||||
string log_name = 1;
|
||||
|
||||
// Optional. A default monitored resource object that is assigned to all log
|
||||
// entries in `entries` that do not specify a value for `resource`. Example:
|
||||
//
|
||||
// { "type": "gce_instance",
|
||||
// "labels": {
|
||||
// "zone": "us-central1-a", "instance_id": "00000000000000000000" }}
|
||||
//
|
||||
// See [LogEntry][google.logging.v2.LogEntry].
|
||||
google.api.MonitoredResource resource = 2;
|
||||
|
||||
// Optional. Default labels that are added to the `labels` field of all log
|
||||
// entries in `entries`. If a log entry already has a label with the same key
|
||||
// as a label in this parameter, then the log entry's label is not changed.
|
||||
// See [LogEntry][google.logging.v2.LogEntry].
|
||||
map<string, string> labels = 3;
|
||||
|
||||
// Required. The log entries to write. Values supplied for the fields
|
||||
// `log_name`, `resource`, and `labels` in this `entries.write` request are
|
||||
// added to those log entries that do not provide their own values for the
|
||||
// fields.
|
||||
//
|
||||
// To improve throughput and to avoid exceeding the
|
||||
// [quota limit](/logging/quota-policy) for calls to `entries.write`,
|
||||
// you should write multiple log entries at once rather than
|
||||
// calling this method for each individual log entry.
|
||||
repeated LogEntry entries = 4;
|
||||
|
||||
// Optional. Whether valid entries should be written even if some other
|
||||
// entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any
|
||||
// entry is not written, the response status will be the error associated
|
||||
// with one of the failed entries and include error details in the form of
|
||||
// WriteLogEntriesPartialErrors.
|
||||
bool partial_success = 5;
|
||||
}
|
||||
|
||||
// Result returned from WriteLogEntries.
|
||||
// empty
|
||||
message WriteLogEntriesResponse {
|
||||
|
||||
}
|
||||
|
||||
// The parameters to `ListLogEntries`.
|
||||
message ListLogEntriesRequest {
|
||||
// Deprecated. One or more project identifiers or project numbers from which
|
||||
// to retrieve log entries. Examples: `"my-project-1A"`, `"1234567890"`. If
|
||||
// present, these project identifiers are converted to resource format and
|
||||
// added to the list of resources in `resourceNames`. Callers should use
|
||||
// `resourceNames` rather than this parameter.
|
||||
repeated string project_ids = 1;
|
||||
|
||||
// Optional. One or more cloud resources from which to retrieve log entries.
|
||||
// Example: `"projects/my-project-1A"`, `"projects/1234567890"`. Projects
|
||||
// listed in `projectIds` are added to this list.
|
||||
repeated string resource_names = 8;
|
||||
|
||||
// Optional. A filter that chooses which log entries to return. See [Advanced
|
||||
// Logs Filters](/logging/docs/view/advanced_filters). Only log entries that
|
||||
// match the filter are returned. An empty filter matches all log entries.
|
||||
string filter = 2;
|
||||
|
||||
// Optional. How the results should be sorted. Presently, the only permitted
|
||||
// values are `"timestamp asc"` (default) and `"timestamp desc"`. The first
|
||||
// option returns entries in order of increasing values of
|
||||
// `LogEntry.timestamp` (oldest first), and the second option returns entries
|
||||
// in order of decreasing timestamps (newest first). Entries with equal
|
||||
// timestamps are returned in order of `LogEntry.insertId`.
|
||||
string order_by = 3;
|
||||
|
||||
// Optional. The maximum number of results to return from this request.
|
||||
// Non-positive values are ignored. The presence of `nextPageToken` in the
|
||||
// response indicates that more results might be available.
|
||||
int32 page_size = 4;
|
||||
|
||||
// Optional. If present, then retrieve the next batch of results from the
|
||||
// preceding call to this method. `pageToken` must be the value of
|
||||
// `nextPageToken` from the previous response. The values of other method
|
||||
// parameters should be identical to those in the previous call.
|
||||
string page_token = 5;
|
||||
}
|
||||
|
||||
// Result returned from `ListLogEntries`.
|
||||
message ListLogEntriesResponse {
|
||||
// A list of log entries.
|
||||
repeated LogEntry entries = 1;
|
||||
|
||||
// If there might be more results than appear in this response, then
|
||||
// `nextPageToken` is included. To get the next set of results, call this
|
||||
// method again using the value of `nextPageToken` as `pageToken`.
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
// The parameters to ListMonitoredResourceDescriptors
|
||||
message ListMonitoredResourceDescriptorsRequest {
|
||||
// Optional. The maximum number of results to return from this request.
|
||||
// Non-positive values are ignored. The presence of `nextPageToken` in the
|
||||
// response indicates that more results might be available.
|
||||
int32 page_size = 1;
|
||||
|
||||
// Optional. If present, then retrieve the next batch of results from the
|
||||
// preceding call to this method. `pageToken` must be the value of
|
||||
// `nextPageToken` from the previous response. The values of other method
|
||||
// parameters should be identical to those in the previous call.
|
||||
string page_token = 2;
|
||||
}
|
||||
|
||||
// Result returned from ListMonitoredResourceDescriptors.
|
||||
message ListMonitoredResourceDescriptorsResponse {
|
||||
// A list of resource descriptors.
|
||||
repeated google.api.MonitoredResourceDescriptor resource_descriptors = 1;
|
||||
|
||||
// If there might be more results than appear in this response, then
|
||||
// `nextPageToken` is included. To get the next set of results, call this
|
||||
// method again using the value of `nextPageToken` as `pageToken`.
|
||||
string next_page_token = 2;
|
||||
}
|
||||
Generated
Vendored
+494
@@ -0,0 +1,494 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/logging/v2/logging_config.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package v2 // import "google.golang.org/genproto/googleapis/logging/v2"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
import google_protobuf5 "github.com/golang/protobuf/ptypes/empty"
|
||||
import _ "github.com/golang/protobuf/ptypes/timestamp"
|
||||
|
||||
import (
|
||||
context "golang.org/x/net/context"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// Available log entry formats. Log entries can be written to Cloud
|
||||
// Logging in either format and can be exported in either format.
|
||||
// Version 2 is the preferred format.
|
||||
type LogSink_VersionFormat int32
|
||||
|
||||
const (
|
||||
// An unspecified version format will default to V2.
|
||||
LogSink_VERSION_FORMAT_UNSPECIFIED LogSink_VersionFormat = 0
|
||||
// `LogEntry` version 2 format.
|
||||
LogSink_V2 LogSink_VersionFormat = 1
|
||||
// `LogEntry` version 1 format.
|
||||
LogSink_V1 LogSink_VersionFormat = 2
|
||||
)
|
||||
|
||||
var LogSink_VersionFormat_name = map[int32]string{
|
||||
0: "VERSION_FORMAT_UNSPECIFIED",
|
||||
1: "V2",
|
||||
2: "V1",
|
||||
}
|
||||
var LogSink_VersionFormat_value = map[string]int32{
|
||||
"VERSION_FORMAT_UNSPECIFIED": 0,
|
||||
"V2": 1,
|
||||
"V1": 2,
|
||||
}
|
||||
|
||||
func (x LogSink_VersionFormat) String() string {
|
||||
return proto.EnumName(LogSink_VersionFormat_name, int32(x))
|
||||
}
|
||||
func (LogSink_VersionFormat) EnumDescriptor() ([]byte, []int) { return fileDescriptor2, []int{0, 0} }
|
||||
|
||||
// Describes a sink used to export log entries outside Stackdriver Logging.
|
||||
type LogSink struct {
|
||||
// Required. The client-assigned sink identifier, unique within the
|
||||
// project. Example: `"my-syslog-errors-to-pubsub"`. Sink identifiers are
|
||||
// limited to 1000 characters and can include only the following characters:
|
||||
// `A-Z`, `a-z`, `0-9`, and the special characters `_-.`. The maximum length
|
||||
// of the name is 100 characters.
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// Required. The export destination. See
|
||||
// [Exporting Logs With Sinks](/logging/docs/api/tasks/exporting-logs).
|
||||
// Examples:
|
||||
//
|
||||
// "storage.googleapis.com/my-gcs-bucket"
|
||||
// "bigquery.googleapis.com/projects/my-project-id/datasets/my-dataset"
|
||||
// "pubsub.googleapis.com/projects/my-project/topics/my-topic"
|
||||
Destination string `protobuf:"bytes,3,opt,name=destination" json:"destination,omitempty"`
|
||||
// Optional. An [advanced logs filter](/logging/docs/view/advanced_filters).
|
||||
// Only log entries matching the filter are exported. The filter
|
||||
// must be consistent with the log entry format specified by the
|
||||
// `outputVersionFormat` parameter, regardless of the format of the
|
||||
// log entry that was originally written to Stackdriver Logging.
|
||||
// Example filter (V2 format):
|
||||
//
|
||||
// logName=projects/my-projectid/logs/syslog AND severity>=ERROR
|
||||
Filter string `protobuf:"bytes,5,opt,name=filter" json:"filter,omitempty"`
|
||||
// Optional. The log entry version to use for this sink's exported log
|
||||
// entries. This version does not have to correspond to the version of the
|
||||
// log entry that was written to Stackdriver Logging. If omitted, the
|
||||
// v2 format is used.
|
||||
OutputVersionFormat LogSink_VersionFormat `protobuf:"varint,6,opt,name=output_version_format,json=outputVersionFormat,enum=google.logging.v2.LogSink_VersionFormat" json:"output_version_format,omitempty"`
|
||||
// Output only. The iam identity to which the destination needs to grant write
|
||||
// access. This may be a service account or a group.
|
||||
// Examples (Do not assume these specific values):
|
||||
// "serviceAccount:cloud-logs@system.gserviceaccount.com"
|
||||
// "group:cloud-logs@google.com"
|
||||
//
|
||||
// For GCS destinations, the role "roles/owner" is required on the bucket
|
||||
// For Cloud Pubsub destinations, the role "roles/pubsub.publisher" is
|
||||
// required on the topic
|
||||
// For BigQuery, the role "roles/editor" is required on the dataset
|
||||
WriterIdentity string `protobuf:"bytes,8,opt,name=writer_identity,json=writerIdentity" json:"writer_identity,omitempty"`
|
||||
}
|
||||
|
||||
func (m *LogSink) Reset() { *m = LogSink{} }
|
||||
func (m *LogSink) String() string { return proto.CompactTextString(m) }
|
||||
func (*LogSink) ProtoMessage() {}
|
||||
func (*LogSink) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} }
|
||||
|
||||
// The parameters to `ListSinks`.
|
||||
type ListSinksRequest struct {
|
||||
// Required. The cloud resource containing the sinks.
|
||||
// Example: `"projects/my-logging-project"`.
|
||||
Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"`
|
||||
// Optional. If present, then retrieve the next batch of results from the
|
||||
// preceding call to this method. `pageToken` must be the value of
|
||||
// `nextPageToken` from the previous response. The values of other method
|
||||
// parameters should be identical to those in the previous call.
|
||||
PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken" json:"page_token,omitempty"`
|
||||
// Optional. The maximum number of results to return from this request.
|
||||
// Non-positive values are ignored. The presence of `nextPageToken` in the
|
||||
// response indicates that more results might be available.
|
||||
PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize" json:"page_size,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ListSinksRequest) Reset() { *m = ListSinksRequest{} }
|
||||
func (m *ListSinksRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListSinksRequest) ProtoMessage() {}
|
||||
func (*ListSinksRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{1} }
|
||||
|
||||
// Result returned from `ListSinks`.
|
||||
type ListSinksResponse struct {
|
||||
// A list of sinks.
|
||||
Sinks []*LogSink `protobuf:"bytes,1,rep,name=sinks" json:"sinks,omitempty"`
|
||||
// If there might be more results than appear in this response, then
|
||||
// `nextPageToken` is included. To get the next set of results, call the same
|
||||
// method again using the value of `nextPageToken` as `pageToken`.
|
||||
NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken" json:"next_page_token,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ListSinksResponse) Reset() { *m = ListSinksResponse{} }
|
||||
func (m *ListSinksResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListSinksResponse) ProtoMessage() {}
|
||||
func (*ListSinksResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{2} }
|
||||
|
||||
func (m *ListSinksResponse) GetSinks() []*LogSink {
|
||||
if m != nil {
|
||||
return m.Sinks
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// The parameters to `GetSink`.
|
||||
type GetSinkRequest struct {
|
||||
// Required. The resource name of the sink to return.
|
||||
// Example: `"projects/my-project-id/sinks/my-sink-id"`.
|
||||
SinkName string `protobuf:"bytes,1,opt,name=sink_name,json=sinkName" json:"sink_name,omitempty"`
|
||||
}
|
||||
|
||||
func (m *GetSinkRequest) Reset() { *m = GetSinkRequest{} }
|
||||
func (m *GetSinkRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetSinkRequest) ProtoMessage() {}
|
||||
func (*GetSinkRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{3} }
|
||||
|
||||
// The parameters to `CreateSink`.
|
||||
type CreateSinkRequest struct {
|
||||
// Required. The resource in which to create the sink.
|
||||
// Example: `"projects/my-project-id"`.
|
||||
// The new sink must be provided in the request.
|
||||
Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"`
|
||||
// Required. The new sink, whose `name` parameter is a sink identifier that
|
||||
// is not already in use.
|
||||
Sink *LogSink `protobuf:"bytes,2,opt,name=sink" json:"sink,omitempty"`
|
||||
}
|
||||
|
||||
func (m *CreateSinkRequest) Reset() { *m = CreateSinkRequest{} }
|
||||
func (m *CreateSinkRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateSinkRequest) ProtoMessage() {}
|
||||
func (*CreateSinkRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{4} }
|
||||
|
||||
func (m *CreateSinkRequest) GetSink() *LogSink {
|
||||
if m != nil {
|
||||
return m.Sink
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// The parameters to `UpdateSink`.
|
||||
type UpdateSinkRequest struct {
|
||||
// Required. The resource name of the sink to update, including the parent
|
||||
// resource and the sink identifier. If the sink does not exist, this method
|
||||
// creates the sink. Example: `"projects/my-project-id/sinks/my-sink-id"`.
|
||||
SinkName string `protobuf:"bytes,1,opt,name=sink_name,json=sinkName" json:"sink_name,omitempty"`
|
||||
// Required. The updated sink, whose name is the same identifier that appears
|
||||
// as part of `sinkName`. If `sinkName` does not exist, then
|
||||
// this method creates a new sink.
|
||||
Sink *LogSink `protobuf:"bytes,2,opt,name=sink" json:"sink,omitempty"`
|
||||
}
|
||||
|
||||
func (m *UpdateSinkRequest) Reset() { *m = UpdateSinkRequest{} }
|
||||
func (m *UpdateSinkRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*UpdateSinkRequest) ProtoMessage() {}
|
||||
func (*UpdateSinkRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{5} }
|
||||
|
||||
func (m *UpdateSinkRequest) GetSink() *LogSink {
|
||||
if m != nil {
|
||||
return m.Sink
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// The parameters to `DeleteSink`.
|
||||
type DeleteSinkRequest struct {
|
||||
// Required. The resource name of the sink to delete, including the parent
|
||||
// resource and the sink identifier. Example:
|
||||
// `"projects/my-project-id/sinks/my-sink-id"`. It is an error if the sink
|
||||
// does not exist.
|
||||
SinkName string `protobuf:"bytes,1,opt,name=sink_name,json=sinkName" json:"sink_name,omitempty"`
|
||||
}
|
||||
|
||||
func (m *DeleteSinkRequest) Reset() { *m = DeleteSinkRequest{} }
|
||||
func (m *DeleteSinkRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*DeleteSinkRequest) ProtoMessage() {}
|
||||
func (*DeleteSinkRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{6} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*LogSink)(nil), "google.logging.v2.LogSink")
|
||||
proto.RegisterType((*ListSinksRequest)(nil), "google.logging.v2.ListSinksRequest")
|
||||
proto.RegisterType((*ListSinksResponse)(nil), "google.logging.v2.ListSinksResponse")
|
||||
proto.RegisterType((*GetSinkRequest)(nil), "google.logging.v2.GetSinkRequest")
|
||||
proto.RegisterType((*CreateSinkRequest)(nil), "google.logging.v2.CreateSinkRequest")
|
||||
proto.RegisterType((*UpdateSinkRequest)(nil), "google.logging.v2.UpdateSinkRequest")
|
||||
proto.RegisterType((*DeleteSinkRequest)(nil), "google.logging.v2.DeleteSinkRequest")
|
||||
proto.RegisterEnum("google.logging.v2.LogSink_VersionFormat", LogSink_VersionFormat_name, LogSink_VersionFormat_value)
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion3
|
||||
|
||||
// Client API for ConfigServiceV2 service
|
||||
|
||||
type ConfigServiceV2Client interface {
|
||||
// Lists sinks.
|
||||
ListSinks(ctx context.Context, in *ListSinksRequest, opts ...grpc.CallOption) (*ListSinksResponse, error)
|
||||
// Gets a sink.
|
||||
GetSink(ctx context.Context, in *GetSinkRequest, opts ...grpc.CallOption) (*LogSink, error)
|
||||
// Creates a sink.
|
||||
CreateSink(ctx context.Context, in *CreateSinkRequest, opts ...grpc.CallOption) (*LogSink, error)
|
||||
// Updates or creates a sink.
|
||||
UpdateSink(ctx context.Context, in *UpdateSinkRequest, opts ...grpc.CallOption) (*LogSink, error)
|
||||
// Deletes a sink.
|
||||
DeleteSink(ctx context.Context, in *DeleteSinkRequest, opts ...grpc.CallOption) (*google_protobuf5.Empty, error)
|
||||
}
|
||||
|
||||
type configServiceV2Client struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewConfigServiceV2Client(cc *grpc.ClientConn) ConfigServiceV2Client {
|
||||
return &configServiceV2Client{cc}
|
||||
}
|
||||
|
||||
func (c *configServiceV2Client) ListSinks(ctx context.Context, in *ListSinksRequest, opts ...grpc.CallOption) (*ListSinksResponse, error) {
|
||||
out := new(ListSinksResponse)
|
||||
err := grpc.Invoke(ctx, "/google.logging.v2.ConfigServiceV2/ListSinks", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *configServiceV2Client) GetSink(ctx context.Context, in *GetSinkRequest, opts ...grpc.CallOption) (*LogSink, error) {
|
||||
out := new(LogSink)
|
||||
err := grpc.Invoke(ctx, "/google.logging.v2.ConfigServiceV2/GetSink", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *configServiceV2Client) CreateSink(ctx context.Context, in *CreateSinkRequest, opts ...grpc.CallOption) (*LogSink, error) {
|
||||
out := new(LogSink)
|
||||
err := grpc.Invoke(ctx, "/google.logging.v2.ConfigServiceV2/CreateSink", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *configServiceV2Client) UpdateSink(ctx context.Context, in *UpdateSinkRequest, opts ...grpc.CallOption) (*LogSink, error) {
|
||||
out := new(LogSink)
|
||||
err := grpc.Invoke(ctx, "/google.logging.v2.ConfigServiceV2/UpdateSink", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *configServiceV2Client) DeleteSink(ctx context.Context, in *DeleteSinkRequest, opts ...grpc.CallOption) (*google_protobuf5.Empty, error) {
|
||||
out := new(google_protobuf5.Empty)
|
||||
err := grpc.Invoke(ctx, "/google.logging.v2.ConfigServiceV2/DeleteSink", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for ConfigServiceV2 service
|
||||
|
||||
type ConfigServiceV2Server interface {
|
||||
// Lists sinks.
|
||||
ListSinks(context.Context, *ListSinksRequest) (*ListSinksResponse, error)
|
||||
// Gets a sink.
|
||||
GetSink(context.Context, *GetSinkRequest) (*LogSink, error)
|
||||
// Creates a sink.
|
||||
CreateSink(context.Context, *CreateSinkRequest) (*LogSink, error)
|
||||
// Updates or creates a sink.
|
||||
UpdateSink(context.Context, *UpdateSinkRequest) (*LogSink, error)
|
||||
// Deletes a sink.
|
||||
DeleteSink(context.Context, *DeleteSinkRequest) (*google_protobuf5.Empty, error)
|
||||
}
|
||||
|
||||
func RegisterConfigServiceV2Server(s *grpc.Server, srv ConfigServiceV2Server) {
|
||||
s.RegisterService(&_ConfigServiceV2_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _ConfigServiceV2_ListSinks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListSinksRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ConfigServiceV2Server).ListSinks(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.logging.v2.ConfigServiceV2/ListSinks",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ConfigServiceV2Server).ListSinks(ctx, req.(*ListSinksRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ConfigServiceV2_GetSink_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetSinkRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ConfigServiceV2Server).GetSink(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.logging.v2.ConfigServiceV2/GetSink",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ConfigServiceV2Server).GetSink(ctx, req.(*GetSinkRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ConfigServiceV2_CreateSink_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateSinkRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ConfigServiceV2Server).CreateSink(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.logging.v2.ConfigServiceV2/CreateSink",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ConfigServiceV2Server).CreateSink(ctx, req.(*CreateSinkRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ConfigServiceV2_UpdateSink_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateSinkRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ConfigServiceV2Server).UpdateSink(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.logging.v2.ConfigServiceV2/UpdateSink",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ConfigServiceV2Server).UpdateSink(ctx, req.(*UpdateSinkRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ConfigServiceV2_DeleteSink_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteSinkRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ConfigServiceV2Server).DeleteSink(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.logging.v2.ConfigServiceV2/DeleteSink",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ConfigServiceV2Server).DeleteSink(ctx, req.(*DeleteSinkRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _ConfigServiceV2_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "google.logging.v2.ConfigServiceV2",
|
||||
HandlerType: (*ConfigServiceV2Server)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "ListSinks",
|
||||
Handler: _ConfigServiceV2_ListSinks_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetSink",
|
||||
Handler: _ConfigServiceV2_GetSink_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateSink",
|
||||
Handler: _ConfigServiceV2_CreateSink_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateSink",
|
||||
Handler: _ConfigServiceV2_UpdateSink_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteSink",
|
||||
Handler: _ConfigServiceV2_DeleteSink_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: fileDescriptor2,
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/logging/v2/logging_config.proto", fileDescriptor2)
|
||||
}
|
||||
|
||||
var fileDescriptor2 = []byte{
|
||||
// 716 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x95, 0xdf, 0x4e, 0x13, 0x4d,
|
||||
0x14, 0xc0, 0xbf, 0x16, 0x28, 0x70, 0x08, 0xd0, 0xce, 0x17, 0x48, 0xb3, 0x06, 0xc5, 0x15, 0x94,
|
||||
0xd4, 0xb8, 0x5b, 0x97, 0x3b, 0x8d, 0x31, 0x02, 0xc5, 0x34, 0x41, 0x20, 0x5b, 0xe8, 0x05, 0x9a,
|
||||
0xac, 0x4b, 0x99, 0xae, 0x23, 0xdd, 0x99, 0x75, 0x77, 0x5a, 0x45, 0x42, 0x62, 0x7c, 0x05, 0x1f,
|
||||
0xc0, 0x87, 0xf2, 0x15, 0x7c, 0x0e, 0xe3, 0xec, 0xcc, 0x96, 0x16, 0x5a, 0xd6, 0x72, 0xb3, 0x9d,
|
||||
0x39, 0xff, 0x7e, 0x67, 0xce, 0x39, 0x33, 0x85, 0x8a, 0xc7, 0x98, 0xd7, 0xc2, 0x86, 0xc7, 0x5a,
|
||||
0x2e, 0xf5, 0x0c, 0x16, 0x7a, 0xa6, 0x87, 0x69, 0x10, 0x32, 0xce, 0x4c, 0xa5, 0x72, 0x03, 0x12,
|
||||
0x99, 0x2d, 0xe6, 0x79, 0x84, 0x7a, 0x66, 0xc7, 0xea, 0x2e, 0x9d, 0x06, 0xa3, 0x4d, 0xe2, 0x19,
|
||||
0xd2, 0x14, 0x15, 0x92, 0x30, 0x89, 0xd2, 0xe8, 0x58, 0x5a, 0x75, 0xb4, 0xc8, 0xe2, 0x63, 0x46,
|
||||
0x38, 0xec, 0x90, 0x06, 0x56, 0x11, 0x4d, 0x97, 0x52, 0xc6, 0x5d, 0x4e, 0x18, 0x8d, 0x54, 0x74,
|
||||
0x6d, 0xdd, 0x23, 0xfc, 0x43, 0xfb, 0xd8, 0x68, 0x30, 0xdf, 0x54, 0xe1, 0x4c, 0xa9, 0x38, 0x6e,
|
||||
0x37, 0xcd, 0x80, 0x9f, 0x05, 0x38, 0x32, 0xb1, 0x2f, 0x16, 0xea, 0x9b, 0x38, 0x3d, 0xff, 0xb7,
|
||||
0x13, 0x27, 0x3e, 0x8e, 0xb8, 0xeb, 0x07, 0xbd, 0x95, 0x72, 0xd6, 0x7f, 0x66, 0x61, 0x72, 0x87,
|
||||
0x79, 0x35, 0x42, 0x4f, 0x11, 0x82, 0x71, 0xea, 0xfa, 0xb8, 0x98, 0x59, 0xce, 0xac, 0x4d, 0xdb,
|
||||
0x72, 0x8d, 0x96, 0x61, 0xe6, 0x44, 0x38, 0x10, 0x2a, 0xf3, 0x2c, 0x8e, 0x49, 0x55, 0xbf, 0x08,
|
||||
0x2d, 0x42, 0xae, 0x49, 0x5a, 0x1c, 0x87, 0xc5, 0x09, 0xa9, 0x4c, 0x76, 0xe8, 0x1d, 0x2c, 0xb0,
|
||||
0x36, 0x0f, 0xda, 0xdc, 0xe9, 0xe0, 0x30, 0x12, 0x96, 0x4e, 0x93, 0x85, 0xbe, 0xcb, 0x8b, 0x39,
|
||||
0x61, 0x36, 0x67, 0xad, 0x19, 0x03, 0x95, 0x34, 0x92, 0x44, 0x8c, 0xba, 0x72, 0xd8, 0x96, 0xf6,
|
||||
0xf6, 0xff, 0x2a, 0xcc, 0x15, 0x21, 0x7a, 0x04, 0xf3, 0x9f, 0x43, 0x22, 0x38, 0x0e, 0x39, 0xc1,
|
||||
0x94, 0x13, 0x7e, 0x56, 0x9c, 0x92, 0xf8, 0x39, 0x25, 0xae, 0x26, 0x52, 0xfd, 0x25, 0xcc, 0x5e,
|
||||
0xf5, 0xbc, 0x0b, 0x5a, 0xbd, 0x62, 0xd7, 0xaa, 0x7b, 0xbb, 0xce, 0xf6, 0x9e, 0xfd, 0xe6, 0xd5,
|
||||
0x81, 0x73, 0xb8, 0x5b, 0xdb, 0xaf, 0x6c, 0x56, 0xb7, 0xab, 0x95, 0xad, 0xfc, 0x7f, 0x28, 0x07,
|
||||
0xd9, 0xba, 0x95, 0xcf, 0xc8, 0xdf, 0xa7, 0xf9, 0xac, 0xde, 0x84, 0xfc, 0x0e, 0x89, 0x78, 0x9c,
|
||||
0x58, 0x64, 0xe3, 0x4f, 0x6d, 0x71, 0xf4, 0xf8, 0xcc, 0x81, 0x1b, 0x0a, 0x42, 0x52, 0xab, 0x64,
|
||||
0x87, 0x96, 0x00, 0x02, 0xd7, 0xc3, 0x0e, 0x67, 0xa7, 0x98, 0x16, 0xb3, 0x52, 0x37, 0x1d, 0x4b,
|
||||
0x0e, 0x62, 0x01, 0xba, 0x03, 0x72, 0xe3, 0x44, 0xe4, 0x2b, 0x96, 0xa5, 0x9c, 0xb0, 0xa7, 0x62,
|
||||
0x41, 0x4d, 0xec, 0x75, 0x1f, 0x0a, 0x7d, 0x9c, 0x28, 0x10, 0x53, 0x81, 0x51, 0x19, 0x26, 0xa2,
|
||||
0x58, 0x20, 0x38, 0x63, 0x6b, 0x33, 0x96, 0x76, 0x73, 0xd1, 0x6c, 0x65, 0x88, 0x1e, 0xc2, 0x3c,
|
||||
0xc5, 0x5f, 0xb8, 0x33, 0x90, 0xc7, 0x6c, 0x2c, 0xde, 0xef, 0xe6, 0xa2, 0x3f, 0x81, 0xb9, 0xd7,
|
||||
0x58, 0xd2, 0xba, 0x87, 0x12, 0xd9, 0xc5, 0x21, 0x9c, 0xbe, 0x19, 0x98, 0x8a, 0x05, 0xbb, 0x62,
|
||||
0xaf, 0xbf, 0x85, 0xc2, 0x66, 0x88, 0x5d, 0x8e, 0xfb, 0x3d, 0x6e, 0x2a, 0x83, 0x01, 0xe3, 0xb1,
|
||||
0xa3, 0x04, 0xa7, 0x27, 0x2d, 0xed, 0xf4, 0xf7, 0x50, 0x38, 0x0c, 0x4e, 0xae, 0x05, 0x4f, 0x4b,
|
||||
0xe7, 0xd6, 0x84, 0x32, 0x14, 0xb6, 0x70, 0x0b, 0x8f, 0x4e, 0xb0, 0xfe, 0x8c, 0xc3, 0xfc, 0xa6,
|
||||
0xbc, 0xa7, 0x35, 0x75, 0x69, 0xeb, 0x16, 0xba, 0x80, 0xe9, 0xcb, 0x16, 0xa1, 0x07, 0xc3, 0xa0,
|
||||
0xd7, 0x06, 0x45, 0x5b, 0x49, 0x37, 0x52, 0x5d, 0xd6, 0x57, 0xbf, 0xff, 0xfa, 0xfd, 0x23, 0x7b,
|
||||
0x0f, 0x2d, 0xc5, 0xcf, 0xce, 0xb9, 0x2a, 0xe2, 0x0b, 0x71, 0x3f, 0x3f, 0xe2, 0x06, 0x8f, 0xcc,
|
||||
0xd2, 0x85, 0xa9, 0x5a, 0xcb, 0x61, 0x32, 0x69, 0x19, 0xba, 0x3f, 0x24, 0xee, 0xd5, 0x76, 0x6a,
|
||||
0x29, 0x45, 0xd1, 0x4b, 0x12, 0xb8, 0x82, 0x74, 0x09, 0xbc, 0x2c, 0x42, 0x1f, 0x53, 0x21, 0x05,
|
||||
0x1b, 0x9d, 0x03, 0xf4, 0x3a, 0x8f, 0x86, 0x1d, 0x68, 0x60, 0x30, 0x52, 0xd9, 0x8f, 0x25, 0x7b,
|
||||
0x55, 0x4f, 0x3f, 0xec, 0x33, 0xd9, 0x37, 0xf4, 0x2d, 0x03, 0xd0, 0x1b, 0x8d, 0xa1, 0xf4, 0x81,
|
||||
0xc9, 0x49, 0xa5, 0x97, 0x25, 0xbd, 0xa4, 0x8d, 0x70, 0xf2, 0x24, 0x85, 0x0e, 0x40, 0x6f, 0x74,
|
||||
0x86, 0x66, 0x30, 0x30, 0x59, 0xda, 0x62, 0xd7, 0xaa, 0xfb, 0x10, 0x1b, 0x95, 0xf8, 0xc1, 0xee,
|
||||
0xd6, 0xbd, 0x34, 0x02, 0x7d, 0xe3, 0x08, 0x16, 0xc4, 0x8b, 0x3e, 0x88, 0xdb, 0x98, 0xdd, 0x51,
|
||||
0x6b, 0x35, 0x9d, 0xfb, 0x99, 0xa3, 0xf2, 0x6d, 0xff, 0xda, 0x8e, 0x73, 0x52, 0xb9, 0xfe, 0x37,
|
||||
0x00, 0x00, 0xff, 0xff, 0x52, 0x86, 0xdf, 0xea, 0x15, 0x07, 0x00, 0x00,
|
||||
}
|
||||
Generated
Vendored
+187
@@ -0,0 +1,187 @@
|
||||
// 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.v2;
|
||||
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto"; // from google/api/annotations.proto
|
||||
import "github.com/golang/protobuf/ptypes/empty/empty.proto"; // from google/protobuf/empty.proto
|
||||
import "github.com/golang/protobuf/ptypes/timestamp/timestamp.proto"; // from google/protobuf/timestamp.proto
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "LoggingConfig";
|
||||
option java_package = "com.google.logging.v2";
|
||||
|
||||
option go_package = "google.golang.org/genproto/googleapis/logging/v2";
|
||||
|
||||
// Service for configuring sinks used to export log entries outside Stackdriver
|
||||
// Logging.
|
||||
service ConfigServiceV2 {
|
||||
// Lists sinks.
|
||||
rpc ListSinks(ListSinksRequest) returns (ListSinksResponse) {
|
||||
option (google.api.http) = { get: "/v2/{parent=projects/*}/sinks" };
|
||||
}
|
||||
|
||||
// Gets a sink.
|
||||
rpc GetSink(GetSinkRequest) returns (LogSink) {
|
||||
option (google.api.http) = { get: "/v2/{sink_name=projects/*/sinks/*}" };
|
||||
}
|
||||
|
||||
// Creates a sink.
|
||||
rpc CreateSink(CreateSinkRequest) returns (LogSink) {
|
||||
option (google.api.http) = { post: "/v2/{parent=projects/*}/sinks" body: "sink" };
|
||||
}
|
||||
|
||||
// Updates or creates a sink.
|
||||
rpc UpdateSink(UpdateSinkRequest) returns (LogSink) {
|
||||
option (google.api.http) = { put: "/v2/{sink_name=projects/*/sinks/*}" body: "sink" };
|
||||
}
|
||||
|
||||
// Deletes a sink.
|
||||
rpc DeleteSink(DeleteSinkRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = { delete: "/v2/{sink_name=projects/*/sinks/*}" };
|
||||
}
|
||||
}
|
||||
|
||||
// Describes a sink used to export log entries outside Stackdriver Logging.
|
||||
message LogSink {
|
||||
// Available log entry formats. Log entries can be written to Cloud
|
||||
// Logging in either format and can be exported in either format.
|
||||
// Version 2 is the preferred format.
|
||||
enum VersionFormat {
|
||||
// An unspecified version format will default to V2.
|
||||
VERSION_FORMAT_UNSPECIFIED = 0;
|
||||
|
||||
// `LogEntry` version 2 format.
|
||||
V2 = 1;
|
||||
|
||||
// `LogEntry` version 1 format.
|
||||
V1 = 2;
|
||||
}
|
||||
|
||||
// Required. The client-assigned sink identifier, unique within the
|
||||
// project. Example: `"my-syslog-errors-to-pubsub"`. Sink identifiers are
|
||||
// limited to 1000 characters and can include only the following characters:
|
||||
// `A-Z`, `a-z`, `0-9`, and the special characters `_-.`. The maximum length
|
||||
// of the name is 100 characters.
|
||||
string name = 1;
|
||||
|
||||
// Required. The export destination. See
|
||||
// [Exporting Logs With Sinks](/logging/docs/api/tasks/exporting-logs).
|
||||
// Examples:
|
||||
//
|
||||
// "storage.googleapis.com/my-gcs-bucket"
|
||||
// "bigquery.googleapis.com/projects/my-project-id/datasets/my-dataset"
|
||||
// "pubsub.googleapis.com/projects/my-project/topics/my-topic"
|
||||
string destination = 3;
|
||||
|
||||
// Optional. An [advanced logs filter](/logging/docs/view/advanced_filters).
|
||||
// Only log entries matching the filter are exported. The filter
|
||||
// must be consistent with the log entry format specified by the
|
||||
// `outputVersionFormat` parameter, regardless of the format of the
|
||||
// log entry that was originally written to Stackdriver Logging.
|
||||
// Example filter (V2 format):
|
||||
//
|
||||
// logName=projects/my-projectid/logs/syslog AND severity>=ERROR
|
||||
string filter = 5;
|
||||
|
||||
// Optional. The log entry version to use for this sink's exported log
|
||||
// entries. This version does not have to correspond to the version of the
|
||||
// log entry that was written to Stackdriver Logging. If omitted, the
|
||||
// v2 format is used.
|
||||
VersionFormat output_version_format = 6;
|
||||
|
||||
// Output only. The iam identity to which the destination needs to grant write
|
||||
// access. This may be a service account or a group.
|
||||
// Examples (Do not assume these specific values):
|
||||
// "serviceAccount:cloud-logs@system.gserviceaccount.com"
|
||||
// "group:cloud-logs@google.com"
|
||||
//
|
||||
// For GCS destinations, the role "roles/owner" is required on the bucket
|
||||
// For Cloud Pubsub destinations, the role "roles/pubsub.publisher" is
|
||||
// required on the topic
|
||||
// For BigQuery, the role "roles/editor" is required on the dataset
|
||||
string writer_identity = 8;
|
||||
}
|
||||
|
||||
// The parameters to `ListSinks`.
|
||||
message ListSinksRequest {
|
||||
// Required. The cloud resource containing the sinks.
|
||||
// Example: `"projects/my-logging-project"`.
|
||||
string parent = 1;
|
||||
|
||||
// Optional. If present, then retrieve the next batch of results from the
|
||||
// preceding call to this method. `pageToken` must be the value of
|
||||
// `nextPageToken` from the previous response. The values of other method
|
||||
// parameters should be identical to those in the previous call.
|
||||
string page_token = 2;
|
||||
|
||||
// Optional. The maximum number of results to return from this request.
|
||||
// Non-positive values are ignored. The presence of `nextPageToken` in the
|
||||
// response indicates that more results might be available.
|
||||
int32 page_size = 3;
|
||||
}
|
||||
|
||||
// Result returned from `ListSinks`.
|
||||
message ListSinksResponse {
|
||||
// A list of sinks.
|
||||
repeated LogSink sinks = 1;
|
||||
|
||||
// If there might be more results than appear in this response, then
|
||||
// `nextPageToken` is included. To get the next set of results, call the same
|
||||
// method again using the value of `nextPageToken` as `pageToken`.
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
// The parameters to `GetSink`.
|
||||
message GetSinkRequest {
|
||||
// Required. The resource name of the sink to return.
|
||||
// Example: `"projects/my-project-id/sinks/my-sink-id"`.
|
||||
string sink_name = 1;
|
||||
}
|
||||
|
||||
// The parameters to `CreateSink`.
|
||||
message CreateSinkRequest {
|
||||
// Required. The resource in which to create the sink.
|
||||
// Example: `"projects/my-project-id"`.
|
||||
// The new sink must be provided in the request.
|
||||
string parent = 1;
|
||||
|
||||
// Required. The new sink, whose `name` parameter is a sink identifier that
|
||||
// is not already in use.
|
||||
LogSink sink = 2;
|
||||
}
|
||||
|
||||
// The parameters to `UpdateSink`.
|
||||
message UpdateSinkRequest {
|
||||
// Required. The resource name of the sink to update, including the parent
|
||||
// resource and the sink identifier. If the sink does not exist, this method
|
||||
// creates the sink. Example: `"projects/my-project-id/sinks/my-sink-id"`.
|
||||
string sink_name = 1;
|
||||
|
||||
// Required. The updated sink, whose name is the same identifier that appears
|
||||
// as part of `sinkName`. If `sinkName` does not exist, then
|
||||
// this method creates a new sink.
|
||||
LogSink sink = 2;
|
||||
}
|
||||
|
||||
// The parameters to `DeleteSink`.
|
||||
message DeleteSinkRequest {
|
||||
// Required. The resource name of the sink to delete, including the parent
|
||||
// resource and the sink identifier. Example:
|
||||
// `"projects/my-project-id/sinks/my-sink-id"`. It is an error if the sink
|
||||
// does not exist.
|
||||
string sink_name = 1;
|
||||
}
|
||||
Generated
Vendored
+465
@@ -0,0 +1,465 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/logging/v2/logging_metrics.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package v2 // import "google.golang.org/genproto/googleapis/logging/v2"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "google.golang.org/genproto/googleapis/api/serviceconfig"
|
||||
import google_protobuf5 "github.com/golang/protobuf/ptypes/empty"
|
||||
|
||||
import (
|
||||
context "golang.org/x/net/context"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// Stackdriver Logging API version.
|
||||
type LogMetric_ApiVersion int32
|
||||
|
||||
const (
|
||||
// Stackdriver Logging API v2.
|
||||
LogMetric_V2 LogMetric_ApiVersion = 0
|
||||
// Stackdriver Logging API v1.
|
||||
LogMetric_V1 LogMetric_ApiVersion = 1
|
||||
)
|
||||
|
||||
var LogMetric_ApiVersion_name = map[int32]string{
|
||||
0: "V2",
|
||||
1: "V1",
|
||||
}
|
||||
var LogMetric_ApiVersion_value = map[string]int32{
|
||||
"V2": 0,
|
||||
"V1": 1,
|
||||
}
|
||||
|
||||
func (x LogMetric_ApiVersion) String() string {
|
||||
return proto.EnumName(LogMetric_ApiVersion_name, int32(x))
|
||||
}
|
||||
func (LogMetric_ApiVersion) EnumDescriptor() ([]byte, []int) { return fileDescriptor3, []int{0, 0} }
|
||||
|
||||
// Describes a logs-based metric. The value of the metric is the
|
||||
// number of log entries that match a logs filter.
|
||||
type LogMetric struct {
|
||||
// Required. The client-assigned metric identifier. Example:
|
||||
// `"severe_errors"`. Metric identifiers are limited to 100
|
||||
// characters and can include only the following characters: `A-Z`,
|
||||
// `a-z`, `0-9`, and the special characters `_-.,+!*',()%/`. The
|
||||
// forward-slash character (`/`) denotes a hierarchy of name pieces,
|
||||
// and it cannot be the first character of the name. The '%' character
|
||||
// is used to URL encode unsafe and reserved characters and must be
|
||||
// followed by two hexadecimal digits according to RFC 1738.
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// Optional. A description of this metric, which is used in documentation.
|
||||
Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"`
|
||||
// Required. An [advanced logs filter](/logging/docs/view/advanced_filters).
|
||||
// Example: `"resource.type=gae_app AND severity>=ERROR"`.
|
||||
Filter string `protobuf:"bytes,3,opt,name=filter" json:"filter,omitempty"`
|
||||
// Output only. The API version that created or updated this metric.
|
||||
// The version also dictates the syntax of the filter expression. When a value
|
||||
// for this field is missing, the default value of V2 should be assumed.
|
||||
Version LogMetric_ApiVersion `protobuf:"varint,4,opt,name=version,enum=google.logging.v2.LogMetric_ApiVersion" json:"version,omitempty"`
|
||||
}
|
||||
|
||||
func (m *LogMetric) Reset() { *m = LogMetric{} }
|
||||
func (m *LogMetric) String() string { return proto.CompactTextString(m) }
|
||||
func (*LogMetric) ProtoMessage() {}
|
||||
func (*LogMetric) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} }
|
||||
|
||||
// The parameters to ListLogMetrics.
|
||||
type ListLogMetricsRequest struct {
|
||||
// Required. The resource name containing the metrics.
|
||||
// Example: `"projects/my-project-id"`.
|
||||
Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"`
|
||||
// Optional. If present, then retrieve the next batch of results from the
|
||||
// preceding call to this method. `pageToken` must be the value of
|
||||
// `nextPageToken` from the previous response. The values of other method
|
||||
// parameters should be identical to those in the previous call.
|
||||
PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken" json:"page_token,omitempty"`
|
||||
// Optional. The maximum number of results to return from this request.
|
||||
// Non-positive values are ignored. The presence of `nextPageToken` in the
|
||||
// response indicates that more results might be available.
|
||||
PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize" json:"page_size,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ListLogMetricsRequest) Reset() { *m = ListLogMetricsRequest{} }
|
||||
func (m *ListLogMetricsRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListLogMetricsRequest) ProtoMessage() {}
|
||||
func (*ListLogMetricsRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{1} }
|
||||
|
||||
// Result returned from ListLogMetrics.
|
||||
type ListLogMetricsResponse struct {
|
||||
// A list of logs-based metrics.
|
||||
Metrics []*LogMetric `protobuf:"bytes,1,rep,name=metrics" json:"metrics,omitempty"`
|
||||
// If there might be more results than appear in this response, then
|
||||
// `nextPageToken` is included. To get the next set of results, call this
|
||||
// method again using the value of `nextPageToken` as `pageToken`.
|
||||
NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken" json:"next_page_token,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ListLogMetricsResponse) Reset() { *m = ListLogMetricsResponse{} }
|
||||
func (m *ListLogMetricsResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListLogMetricsResponse) ProtoMessage() {}
|
||||
func (*ListLogMetricsResponse) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{2} }
|
||||
|
||||
func (m *ListLogMetricsResponse) GetMetrics() []*LogMetric {
|
||||
if m != nil {
|
||||
return m.Metrics
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// The parameters to GetLogMetric.
|
||||
type GetLogMetricRequest struct {
|
||||
// The resource name of the desired metric.
|
||||
// Example: `"projects/my-project-id/metrics/my-metric-id"`.
|
||||
MetricName string `protobuf:"bytes,1,opt,name=metric_name,json=metricName" json:"metric_name,omitempty"`
|
||||
}
|
||||
|
||||
func (m *GetLogMetricRequest) Reset() { *m = GetLogMetricRequest{} }
|
||||
func (m *GetLogMetricRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetLogMetricRequest) ProtoMessage() {}
|
||||
func (*GetLogMetricRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{3} }
|
||||
|
||||
// The parameters to CreateLogMetric.
|
||||
type CreateLogMetricRequest struct {
|
||||
// The resource name of the project in which to create the metric.
|
||||
// Example: `"projects/my-project-id"`.
|
||||
//
|
||||
// The new metric must be provided in the request.
|
||||
Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"`
|
||||
// The new logs-based metric, which must not have an identifier that
|
||||
// already exists.
|
||||
Metric *LogMetric `protobuf:"bytes,2,opt,name=metric" json:"metric,omitempty"`
|
||||
}
|
||||
|
||||
func (m *CreateLogMetricRequest) Reset() { *m = CreateLogMetricRequest{} }
|
||||
func (m *CreateLogMetricRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateLogMetricRequest) ProtoMessage() {}
|
||||
func (*CreateLogMetricRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{4} }
|
||||
|
||||
func (m *CreateLogMetricRequest) GetMetric() *LogMetric {
|
||||
if m != nil {
|
||||
return m.Metric
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// The parameters to UpdateLogMetric.
|
||||
type UpdateLogMetricRequest struct {
|
||||
// The resource name of the metric to update.
|
||||
// Example: `"projects/my-project-id/metrics/my-metric-id"`.
|
||||
//
|
||||
// The updated metric must be provided in the request and have the
|
||||
// same identifier that is specified in `metricName`.
|
||||
// If the metric does not exist, it is created.
|
||||
MetricName string `protobuf:"bytes,1,opt,name=metric_name,json=metricName" json:"metric_name,omitempty"`
|
||||
// The updated metric, whose name must be the same as the
|
||||
// metric identifier in `metricName`. If `metricName` does not
|
||||
// exist, then a new metric is created.
|
||||
Metric *LogMetric `protobuf:"bytes,2,opt,name=metric" json:"metric,omitempty"`
|
||||
}
|
||||
|
||||
func (m *UpdateLogMetricRequest) Reset() { *m = UpdateLogMetricRequest{} }
|
||||
func (m *UpdateLogMetricRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*UpdateLogMetricRequest) ProtoMessage() {}
|
||||
func (*UpdateLogMetricRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{5} }
|
||||
|
||||
func (m *UpdateLogMetricRequest) GetMetric() *LogMetric {
|
||||
if m != nil {
|
||||
return m.Metric
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// The parameters to DeleteLogMetric.
|
||||
type DeleteLogMetricRequest struct {
|
||||
// The resource name of the metric to delete.
|
||||
// Example: `"projects/my-project-id/metrics/my-metric-id"`.
|
||||
MetricName string `protobuf:"bytes,1,opt,name=metric_name,json=metricName" json:"metric_name,omitempty"`
|
||||
}
|
||||
|
||||
func (m *DeleteLogMetricRequest) Reset() { *m = DeleteLogMetricRequest{} }
|
||||
func (m *DeleteLogMetricRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*DeleteLogMetricRequest) ProtoMessage() {}
|
||||
func (*DeleteLogMetricRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{6} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*LogMetric)(nil), "google.logging.v2.LogMetric")
|
||||
proto.RegisterType((*ListLogMetricsRequest)(nil), "google.logging.v2.ListLogMetricsRequest")
|
||||
proto.RegisterType((*ListLogMetricsResponse)(nil), "google.logging.v2.ListLogMetricsResponse")
|
||||
proto.RegisterType((*GetLogMetricRequest)(nil), "google.logging.v2.GetLogMetricRequest")
|
||||
proto.RegisterType((*CreateLogMetricRequest)(nil), "google.logging.v2.CreateLogMetricRequest")
|
||||
proto.RegisterType((*UpdateLogMetricRequest)(nil), "google.logging.v2.UpdateLogMetricRequest")
|
||||
proto.RegisterType((*DeleteLogMetricRequest)(nil), "google.logging.v2.DeleteLogMetricRequest")
|
||||
proto.RegisterEnum("google.logging.v2.LogMetric_ApiVersion", LogMetric_ApiVersion_name, LogMetric_ApiVersion_value)
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion3
|
||||
|
||||
// Client API for MetricsServiceV2 service
|
||||
|
||||
type MetricsServiceV2Client interface {
|
||||
// Lists logs-based metrics.
|
||||
ListLogMetrics(ctx context.Context, in *ListLogMetricsRequest, opts ...grpc.CallOption) (*ListLogMetricsResponse, error)
|
||||
// Gets a logs-based metric.
|
||||
GetLogMetric(ctx context.Context, in *GetLogMetricRequest, opts ...grpc.CallOption) (*LogMetric, error)
|
||||
// Creates a logs-based metric.
|
||||
CreateLogMetric(ctx context.Context, in *CreateLogMetricRequest, opts ...grpc.CallOption) (*LogMetric, error)
|
||||
// Creates or updates a logs-based metric.
|
||||
UpdateLogMetric(ctx context.Context, in *UpdateLogMetricRequest, opts ...grpc.CallOption) (*LogMetric, error)
|
||||
// Deletes a logs-based metric.
|
||||
DeleteLogMetric(ctx context.Context, in *DeleteLogMetricRequest, opts ...grpc.CallOption) (*google_protobuf5.Empty, error)
|
||||
}
|
||||
|
||||
type metricsServiceV2Client struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewMetricsServiceV2Client(cc *grpc.ClientConn) MetricsServiceV2Client {
|
||||
return &metricsServiceV2Client{cc}
|
||||
}
|
||||
|
||||
func (c *metricsServiceV2Client) ListLogMetrics(ctx context.Context, in *ListLogMetricsRequest, opts ...grpc.CallOption) (*ListLogMetricsResponse, error) {
|
||||
out := new(ListLogMetricsResponse)
|
||||
err := grpc.Invoke(ctx, "/google.logging.v2.MetricsServiceV2/ListLogMetrics", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *metricsServiceV2Client) GetLogMetric(ctx context.Context, in *GetLogMetricRequest, opts ...grpc.CallOption) (*LogMetric, error) {
|
||||
out := new(LogMetric)
|
||||
err := grpc.Invoke(ctx, "/google.logging.v2.MetricsServiceV2/GetLogMetric", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *metricsServiceV2Client) CreateLogMetric(ctx context.Context, in *CreateLogMetricRequest, opts ...grpc.CallOption) (*LogMetric, error) {
|
||||
out := new(LogMetric)
|
||||
err := grpc.Invoke(ctx, "/google.logging.v2.MetricsServiceV2/CreateLogMetric", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *metricsServiceV2Client) UpdateLogMetric(ctx context.Context, in *UpdateLogMetricRequest, opts ...grpc.CallOption) (*LogMetric, error) {
|
||||
out := new(LogMetric)
|
||||
err := grpc.Invoke(ctx, "/google.logging.v2.MetricsServiceV2/UpdateLogMetric", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *metricsServiceV2Client) DeleteLogMetric(ctx context.Context, in *DeleteLogMetricRequest, opts ...grpc.CallOption) (*google_protobuf5.Empty, error) {
|
||||
out := new(google_protobuf5.Empty)
|
||||
err := grpc.Invoke(ctx, "/google.logging.v2.MetricsServiceV2/DeleteLogMetric", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for MetricsServiceV2 service
|
||||
|
||||
type MetricsServiceV2Server interface {
|
||||
// Lists logs-based metrics.
|
||||
ListLogMetrics(context.Context, *ListLogMetricsRequest) (*ListLogMetricsResponse, error)
|
||||
// Gets a logs-based metric.
|
||||
GetLogMetric(context.Context, *GetLogMetricRequest) (*LogMetric, error)
|
||||
// Creates a logs-based metric.
|
||||
CreateLogMetric(context.Context, *CreateLogMetricRequest) (*LogMetric, error)
|
||||
// Creates or updates a logs-based metric.
|
||||
UpdateLogMetric(context.Context, *UpdateLogMetricRequest) (*LogMetric, error)
|
||||
// Deletes a logs-based metric.
|
||||
DeleteLogMetric(context.Context, *DeleteLogMetricRequest) (*google_protobuf5.Empty, error)
|
||||
}
|
||||
|
||||
func RegisterMetricsServiceV2Server(s *grpc.Server, srv MetricsServiceV2Server) {
|
||||
s.RegisterService(&_MetricsServiceV2_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _MetricsServiceV2_ListLogMetrics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListLogMetricsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MetricsServiceV2Server).ListLogMetrics(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.logging.v2.MetricsServiceV2/ListLogMetrics",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MetricsServiceV2Server).ListLogMetrics(ctx, req.(*ListLogMetricsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _MetricsServiceV2_GetLogMetric_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetLogMetricRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MetricsServiceV2Server).GetLogMetric(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.logging.v2.MetricsServiceV2/GetLogMetric",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MetricsServiceV2Server).GetLogMetric(ctx, req.(*GetLogMetricRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _MetricsServiceV2_CreateLogMetric_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateLogMetricRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MetricsServiceV2Server).CreateLogMetric(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.logging.v2.MetricsServiceV2/CreateLogMetric",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MetricsServiceV2Server).CreateLogMetric(ctx, req.(*CreateLogMetricRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _MetricsServiceV2_UpdateLogMetric_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateLogMetricRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MetricsServiceV2Server).UpdateLogMetric(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.logging.v2.MetricsServiceV2/UpdateLogMetric",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MetricsServiceV2Server).UpdateLogMetric(ctx, req.(*UpdateLogMetricRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _MetricsServiceV2_DeleteLogMetric_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteLogMetricRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MetricsServiceV2Server).DeleteLogMetric(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.logging.v2.MetricsServiceV2/DeleteLogMetric",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MetricsServiceV2Server).DeleteLogMetric(ctx, req.(*DeleteLogMetricRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _MetricsServiceV2_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "google.logging.v2.MetricsServiceV2",
|
||||
HandlerType: (*MetricsServiceV2Server)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "ListLogMetrics",
|
||||
Handler: _MetricsServiceV2_ListLogMetrics_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetLogMetric",
|
||||
Handler: _MetricsServiceV2_GetLogMetric_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateLogMetric",
|
||||
Handler: _MetricsServiceV2_CreateLogMetric_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateLogMetric",
|
||||
Handler: _MetricsServiceV2_UpdateLogMetric_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteLogMetric",
|
||||
Handler: _MetricsServiceV2_DeleteLogMetric_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: fileDescriptor3,
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/logging/v2/logging_metrics.proto", fileDescriptor3)
|
||||
}
|
||||
|
||||
var fileDescriptor3 = []byte{
|
||||
// 648 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x4e, 0x14, 0x4f,
|
||||
0x10, 0xfe, 0x0d, 0x7f, 0x96, 0x1f, 0x85, 0x02, 0xb6, 0x61, 0x43, 0x46, 0x0c, 0x38, 0x07, 0x58,
|
||||
0x38, 0x4c, 0xe3, 0x60, 0x48, 0x34, 0xf1, 0x00, 0xfe, 0x8b, 0x09, 0x1a, 0xb2, 0x28, 0x07, 0x3d,
|
||||
0x6c, 0x86, 0xa1, 0xb6, 0x6d, 0xd9, 0x9d, 0x1e, 0xa7, 0x9b, 0x0d, 0x6a, 0xbc, 0x18, 0x6f, 0x26,
|
||||
0x1e, 0xf4, 0x6d, 0x7c, 0x0d, 0x7d, 0x04, 0x1f, 0xc4, 0x9e, 0xee, 0x19, 0x58, 0x77, 0x47, 0x76,
|
||||
0xe5, 0x32, 0xdb, 0x5d, 0x55, 0x5d, 0xdf, 0x57, 0x55, 0x5f, 0xf7, 0xc2, 0x43, 0x26, 0x04, 0x6b,
|
||||
0xa1, 0xcf, 0x44, 0x2b, 0x8c, 0x99, 0x2f, 0x52, 0x46, 0x19, 0xc6, 0x49, 0x2a, 0x94, 0xa0, 0xd6,
|
||||
0x15, 0x26, 0x5c, 0xd2, 0x96, 0x60, 0x8c, 0xc7, 0x8c, 0x76, 0x82, 0x62, 0xd9, 0x68, 0xa3, 0x4a,
|
||||
0x79, 0x24, 0x7d, 0x13, 0x4b, 0xae, 0xe4, 0x79, 0x72, 0xaf, 0xdf, 0x09, 0xdc, 0xc7, 0xc3, 0xa5,
|
||||
0xd6, 0x1f, 0x2a, 0x31, 0xed, 0xf0, 0x08, 0x23, 0x11, 0x37, 0x39, 0xa3, 0x61, 0x1c, 0x0b, 0x15,
|
||||
0x2a, 0x2e, 0xe2, 0x3c, 0xbb, 0xbb, 0xc1, 0xb8, 0x7a, 0x75, 0x7c, 0xe0, 0x47, 0xa2, 0x4d, 0x6d,
|
||||
0x3a, 0x6a, 0x1c, 0x07, 0xc7, 0x4d, 0x9a, 0xa8, 0xb7, 0x09, 0x4a, 0x8a, 0x6d, 0xbd, 0xb0, 0x5f,
|
||||
0x7b, 0xc8, 0xfb, 0xee, 0xc0, 0xe4, 0x8e, 0x60, 0x4f, 0x0c, 0x4f, 0x42, 0x60, 0x2c, 0x0e, 0xdb,
|
||||
0x38, 0xef, 0x2c, 0x39, 0xb5, 0xc9, 0xba, 0x59, 0x93, 0x25, 0x98, 0x3a, 0x44, 0x19, 0xa5, 0x3c,
|
||||
0xc9, 0xc0, 0xe6, 0x47, 0x8c, 0xab, 0xdb, 0x44, 0xaa, 0x50, 0x69, 0xf2, 0x96, 0xc2, 0x74, 0x7e,
|
||||
0xd4, 0x38, 0xf3, 0x1d, 0xd9, 0x82, 0x89, 0x0e, 0xa6, 0x32, 0x3b, 0x35, 0xa6, 0x1d, 0xd3, 0xc1,
|
||||
0x8a, 0xdf, 0xd7, 0x00, 0xff, 0x14, 0xdc, 0xdf, 0x4a, 0xf8, 0xbe, 0x0d, 0xaf, 0x17, 0xe7, 0xbc,
|
||||
0x05, 0x80, 0x33, 0x33, 0xa9, 0xc0, 0xc8, 0x7e, 0x30, 0xfb, 0x9f, 0xf9, 0xbd, 0x39, 0xeb, 0x78,
|
||||
0x47, 0x30, 0xb7, 0xc3, 0xa5, 0x3a, 0x4d, 0x21, 0xeb, 0xf8, 0xe6, 0x18, 0xa5, 0xca, 0x18, 0x25,
|
||||
0x61, 0x8a, 0xb1, 0xca, 0x2b, 0xc9, 0x77, 0xe4, 0x3a, 0x40, 0x12, 0x32, 0x6c, 0x28, 0x71, 0x84,
|
||||
0x45, 0x29, 0x93, 0x99, 0xe5, 0x59, 0x66, 0x20, 0xd7, 0xc0, 0x6c, 0x1a, 0x92, 0xbf, 0x43, 0x53,
|
||||
0xcb, 0x78, 0xfd, 0xff, 0xcc, 0xb0, 0xa7, 0xf7, 0xde, 0x09, 0x54, 0x7b, 0xc1, 0x64, 0xa2, 0xbb,
|
||||
0x8f, 0x64, 0x13, 0x26, 0xf2, 0x39, 0x6b, 0xb8, 0xd1, 0xda, 0x54, 0xb0, 0x70, 0x5e, 0x9d, 0xf5,
|
||||
0x22, 0x98, 0x2c, 0xc3, 0x4c, 0x8c, 0x27, 0xaa, 0xd1, 0x47, 0xe9, 0x72, 0x66, 0xde, 0x2d, 0x68,
|
||||
0x79, 0x9b, 0x70, 0xf5, 0x11, 0x9e, 0x01, 0x17, 0x45, 0x2e, 0xc2, 0x94, 0xcd, 0xd4, 0xe8, 0x9a,
|
||||
0x19, 0x58, 0xd3, 0x53, 0x6d, 0xf1, 0x9a, 0x50, 0xbd, 0x97, 0x62, 0xa8, 0xb0, 0xef, 0xe8, 0xdf,
|
||||
0xfa, 0x73, 0x0b, 0x2a, 0xf6, 0xbc, 0x21, 0x32, 0xa8, 0x90, 0x3c, 0xd6, 0x13, 0x50, 0x7d, 0x9e,
|
||||
0x1c, 0x96, 0xe1, 0x0c, 0xa2, 0x78, 0x41, 0xc0, 0xdb, 0x50, 0xbd, 0x8f, 0x2d, 0xbc, 0x00, 0x60,
|
||||
0xf0, 0x73, 0x1c, 0x66, 0xf3, 0xf9, 0xed, 0xd9, 0xfb, 0xb4, 0x1f, 0x90, 0x2f, 0x0e, 0x4c, 0xff,
|
||||
0x39, 0x5b, 0x52, 0x2b, 0x23, 0x52, 0xa6, 0x35, 0x77, 0x75, 0x88, 0x48, 0x2b, 0x14, 0x6f, 0xe5,
|
||||
0xe3, 0x8f, 0x5f, 0xdf, 0x46, 0x6e, 0x90, 0xc5, 0xec, 0x89, 0x78, 0x6f, 0x7b, 0x7e, 0x57, 0xdf,
|
||||
0xc3, 0xd7, 0x18, 0x29, 0x49, 0xd7, 0x3e, 0xd0, 0x42, 0x19, 0x9f, 0x1c, 0xb8, 0xd4, 0x3d, 0x72,
|
||||
0xb2, 0x5c, 0x02, 0x52, 0xa2, 0x09, 0xf7, 0xdc, 0xfe, 0x79, 0xbe, 0xc1, 0xaf, 0x91, 0x65, 0x83,
|
||||
0xdf, 0xd5, 0xa8, 0x2e, 0x12, 0x05, 0x07, 0x4d, 0x87, 0x7c, 0x76, 0x60, 0xa6, 0x47, 0x41, 0xa4,
|
||||
0xac, 0xdc, 0x72, 0x95, 0x0d, 0x20, 0x43, 0x0d, 0x99, 0x55, 0x6f, 0x50, 0x33, 0xee, 0xe4, 0x53,
|
||||
0x27, 0x5f, 0x35, 0x9b, 0x1e, 0x9d, 0x95, 0xb2, 0x29, 0xd7, 0xe2, 0x00, 0x36, 0x9b, 0x86, 0xcd,
|
||||
0xba, 0x3b, 0x64, 0x6b, 0x4e, 0x49, 0xe9, 0x49, 0xcd, 0xf4, 0x68, 0xb1, 0x94, 0x54, 0xb9, 0x5e,
|
||||
0xdd, 0x6a, 0x11, 0x5a, 0xbc, 0xd4, 0xfe, 0x83, 0xec, 0x71, 0x2e, 0x26, 0xb5, 0x36, 0x24, 0x9d,
|
||||
0xed, 0x97, 0x30, 0xa7, 0x9f, 0xfd, 0x7e, 0xdc, 0xed, 0xe9, 0x1d, 0xbb, 0xce, 0xa5, 0xb8, 0xeb,
|
||||
0xbc, 0x58, 0xff, 0xd7, 0x3f, 0xb3, 0x83, 0x8a, 0x71, 0x6e, 0xfc, 0x0e, 0x00, 0x00, 0xff, 0xff,
|
||||
0x46, 0x24, 0x21, 0x19, 0x07, 0x07, 0x00, 0x00,
|
||||
}
|
||||
Generated
Vendored
+161
@@ -0,0 +1,161 @@
|
||||
// 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.v2;
|
||||
|
||||
import "google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto"; // from google/api/annotations.proto
|
||||
import "github.com/golang/protobuf/ptypes/empty/empty.proto"; // from google/protobuf/empty.proto
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "LoggingMetrics";
|
||||
option java_package = "com.google.logging.v2";
|
||||
|
||||
option go_package = "google.golang.org/genproto/googleapis/logging/v2";
|
||||
|
||||
// Service for configuring logs-based metrics.
|
||||
service MetricsServiceV2 {
|
||||
// Lists logs-based metrics.
|
||||
rpc ListLogMetrics(ListLogMetricsRequest) returns (ListLogMetricsResponse) {
|
||||
option (google.api.http) = { get: "/v2/{parent=projects/*}/metrics" };
|
||||
}
|
||||
|
||||
// Gets a logs-based metric.
|
||||
rpc GetLogMetric(GetLogMetricRequest) returns (LogMetric) {
|
||||
option (google.api.http) = { get: "/v2/{metric_name=projects/*/metrics/*}" };
|
||||
}
|
||||
|
||||
// Creates a logs-based metric.
|
||||
rpc CreateLogMetric(CreateLogMetricRequest) returns (LogMetric) {
|
||||
option (google.api.http) = { post: "/v2/{parent=projects/*}/metrics" body: "metric" };
|
||||
}
|
||||
|
||||
// Creates or updates a logs-based metric.
|
||||
rpc UpdateLogMetric(UpdateLogMetricRequest) returns (LogMetric) {
|
||||
option (google.api.http) = { put: "/v2/{metric_name=projects/*/metrics/*}" body: "metric" };
|
||||
}
|
||||
|
||||
// Deletes a logs-based metric.
|
||||
rpc DeleteLogMetric(DeleteLogMetricRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = { delete: "/v2/{metric_name=projects/*/metrics/*}" };
|
||||
}
|
||||
}
|
||||
|
||||
// Describes a logs-based metric. The value of the metric is the
|
||||
// number of log entries that match a logs filter.
|
||||
message LogMetric {
|
||||
// Stackdriver Logging API version.
|
||||
enum ApiVersion {
|
||||
// Stackdriver Logging API v2.
|
||||
V2 = 0;
|
||||
|
||||
// Stackdriver Logging API v1.
|
||||
V1 = 1;
|
||||
}
|
||||
|
||||
// Required. The client-assigned metric identifier. Example:
|
||||
// `"severe_errors"`. Metric identifiers are limited to 100
|
||||
// characters and can include only the following characters: `A-Z`,
|
||||
// `a-z`, `0-9`, and the special characters `_-.,+!*',()%/`. The
|
||||
// forward-slash character (`/`) denotes a hierarchy of name pieces,
|
||||
// and it cannot be the first character of the name. The '%' character
|
||||
// is used to URL encode unsafe and reserved characters and must be
|
||||
// followed by two hexadecimal digits according to RFC 1738.
|
||||
string name = 1;
|
||||
|
||||
// Optional. A description of this metric, which is used in documentation.
|
||||
string description = 2;
|
||||
|
||||
// Required. An [advanced logs filter](/logging/docs/view/advanced_filters).
|
||||
// Example: `"resource.type=gae_app AND severity>=ERROR"`.
|
||||
string filter = 3;
|
||||
|
||||
// Output only. The API version that created or updated this metric.
|
||||
// The version also dictates the syntax of the filter expression. When a value
|
||||
// for this field is missing, the default value of V2 should be assumed.
|
||||
ApiVersion version = 4;
|
||||
}
|
||||
|
||||
// The parameters to ListLogMetrics.
|
||||
message ListLogMetricsRequest {
|
||||
// Required. The resource name containing the metrics.
|
||||
// Example: `"projects/my-project-id"`.
|
||||
string parent = 1;
|
||||
|
||||
// Optional. If present, then retrieve the next batch of results from the
|
||||
// preceding call to this method. `pageToken` must be the value of
|
||||
// `nextPageToken` from the previous response. The values of other method
|
||||
// parameters should be identical to those in the previous call.
|
||||
string page_token = 2;
|
||||
|
||||
// Optional. The maximum number of results to return from this request.
|
||||
// Non-positive values are ignored. The presence of `nextPageToken` in the
|
||||
// response indicates that more results might be available.
|
||||
int32 page_size = 3;
|
||||
}
|
||||
|
||||
// Result returned from ListLogMetrics.
|
||||
message ListLogMetricsResponse {
|
||||
// A list of logs-based metrics.
|
||||
repeated LogMetric metrics = 1;
|
||||
|
||||
// If there might be more results than appear in this response, then
|
||||
// `nextPageToken` is included. To get the next set of results, call this
|
||||
// method again using the value of `nextPageToken` as `pageToken`.
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
// The parameters to GetLogMetric.
|
||||
message GetLogMetricRequest {
|
||||
// The resource name of the desired metric.
|
||||
// Example: `"projects/my-project-id/metrics/my-metric-id"`.
|
||||
string metric_name = 1;
|
||||
}
|
||||
|
||||
// The parameters to CreateLogMetric.
|
||||
message CreateLogMetricRequest {
|
||||
// The resource name of the project in which to create the metric.
|
||||
// Example: `"projects/my-project-id"`.
|
||||
//
|
||||
// The new metric must be provided in the request.
|
||||
string parent = 1;
|
||||
|
||||
// The new logs-based metric, which must not have an identifier that
|
||||
// already exists.
|
||||
LogMetric metric = 2;
|
||||
}
|
||||
|
||||
// The parameters to UpdateLogMetric.
|
||||
message UpdateLogMetricRequest {
|
||||
// The resource name of the metric to update.
|
||||
// Example: `"projects/my-project-id/metrics/my-metric-id"`.
|
||||
//
|
||||
// The updated metric must be provided in the request and have the
|
||||
// same identifier that is specified in `metricName`.
|
||||
// If the metric does not exist, it is created.
|
||||
string metric_name = 1;
|
||||
|
||||
// The updated metric, whose name must be the same as the
|
||||
// metric identifier in `metricName`. If `metricName` does not
|
||||
// exist, then a new metric is created.
|
||||
LogMetric metric = 2;
|
||||
}
|
||||
|
||||
// The parameters to DeleteLogMetric.
|
||||
message DeleteLogMetricRequest {
|
||||
// The resource name of the metric to delete.
|
||||
// Example: `"projects/my-project-id/metrics/my-metric-id"`.
|
||||
string metric_name = 1;
|
||||
}
|
||||
Generated
Vendored
+131
@@ -0,0 +1,131 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/googleapis/rpc/status/status.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package google_rpc is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
google.golang.org/genproto/googleapis/rpc/status/status.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Status
|
||||
*/
|
||||
package google_rpc // import "google.golang.org/genproto/googleapis/rpc/status"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import google_protobuf "github.com/golang/protobuf/ptypes/any"
|
||||
|
||||
// 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 `Status` type defines a logical error model that is suitable for different
|
||||
// programming environments, including REST APIs and RPC APIs. It is used by
|
||||
// [gRPC](https://github.com/grpc). The error model is designed to be:
|
||||
//
|
||||
// - Simple to use and understand for most users
|
||||
// - Flexible enough to meet unexpected needs
|
||||
//
|
||||
// # Overview
|
||||
//
|
||||
// The `Status` message contains three pieces of data: error code, error message,
|
||||
// and error details. The error code should be an enum value of
|
||||
// [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The
|
||||
// error message should be a developer-facing English message that helps
|
||||
// developers *understand* and *resolve* the error. If a localized user-facing
|
||||
// error message is needed, put the localized message in the error details or
|
||||
// localize it in the client. The optional error details may contain arbitrary
|
||||
// information about the error. There is a predefined set of error detail types
|
||||
// in the package `google.rpc` which can be used for common error conditions.
|
||||
//
|
||||
// # Language mapping
|
||||
//
|
||||
// The `Status` message is the logical representation of the error model, but it
|
||||
// is not necessarily the actual wire format. When the `Status` message is
|
||||
// exposed in different client libraries and different wire protocols, it can be
|
||||
// mapped differently. For example, it will likely be mapped to some exceptions
|
||||
// in Java, but more likely mapped to some error codes in C.
|
||||
//
|
||||
// # Other uses
|
||||
//
|
||||
// The error model and the `Status` message can be used in a variety of
|
||||
// environments, either with or without APIs, to provide a
|
||||
// consistent developer experience across different environments.
|
||||
//
|
||||
// Example uses of this error model include:
|
||||
//
|
||||
// - Partial errors. If a service needs to return partial errors to the client,
|
||||
// it may embed the `Status` in the normal response to indicate the partial
|
||||
// errors.
|
||||
//
|
||||
// - Workflow errors. A typical workflow has multiple steps. Each step may
|
||||
// have a `Status` message for error reporting purpose.
|
||||
//
|
||||
// - Batch operations. If a client uses batch request and batch response, the
|
||||
// `Status` message should be used directly inside batch response, one for
|
||||
// each error sub-response.
|
||||
//
|
||||
// - Asynchronous operations. If an API call embeds asynchronous operation
|
||||
// results in its response, the status of those operations should be
|
||||
// represented directly using the `Status` message.
|
||||
//
|
||||
// - Logging. If some API errors are stored in logs, the message `Status` could
|
||||
// be used directly after any stripping needed for security/privacy reasons.
|
||||
type Status struct {
|
||||
// The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
|
||||
Code int32 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"`
|
||||
// A developer-facing error message, which should be in English. Any
|
||||
// user-facing error message should be localized and sent in the
|
||||
// [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
|
||||
Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
|
||||
// A list of messages that carry the error details. There will be a
|
||||
// common set of message types for APIs to use.
|
||||
Details []*google_protobuf.Any `protobuf:"bytes,3,rep,name=details" json:"details,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Status) Reset() { *m = Status{} }
|
||||
func (m *Status) String() string { return proto.CompactTextString(m) }
|
||||
func (*Status) ProtoMessage() {}
|
||||
func (*Status) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *Status) GetDetails() []*google_protobuf.Any {
|
||||
if m != nil {
|
||||
return m.Details
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Status)(nil), "google.rpc.Status")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/googleapis/rpc/status/status.proto", fileDescriptor0)
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 208 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x44, 0x8e, 0xcd, 0x4e, 0x84, 0x30,
|
||||
0x10, 0xc7, 0x83, 0xab, 0xbb, 0xb1, 0x9b, 0x78, 0x68, 0x3c, 0x34, 0x5e, 0xdc, 0x78, 0xe2, 0x34,
|
||||
0x93, 0xe8, 0xd9, 0x83, 0x3c, 0x01, 0xc1, 0x27, 0x28, 0x50, 0x46, 0x12, 0xe8, 0x34, 0xb4, 0x1c,
|
||||
0x78, 0x7b, 0xa1, 0x85, 0xec, 0xa1, 0x69, 0x3b, 0xf3, 0xfb, 0x7f, 0x88, 0x6f, 0x62, 0xa6, 0xc1,
|
||||
0x00, 0xf1, 0xa0, 0x2d, 0x01, 0x4f, 0x84, 0x64, 0xac, 0x9b, 0x38, 0x30, 0xa6, 0x95, 0x76, 0xbd,
|
||||
0xc7, 0xc9, 0x35, 0xe8, 0x83, 0x0e, 0xb3, 0xdf, 0x2f, 0x88, 0x88, 0x14, 0xbb, 0x7c, 0xdd, 0xbf,
|
||||
0x21, 0xf5, 0xe1, 0x6f, 0xae, 0xa1, 0xe1, 0x11, 0x93, 0x1d, 0x46, 0xa8, 0x9e, 0x3b, 0x74, 0x61,
|
||||
0x71, 0xc6, 0xa3, 0xb6, 0xcb, 0x76, 0x92, 0xf8, 0xa3, 0x13, 0xe7, 0xdf, 0x68, 0x26, 0xa5, 0x78,
|
||||
0x6c, 0xb8, 0x35, 0x2a, 0xbb, 0x65, 0xf9, 0x53, 0x15, 0xdf, 0x52, 0x89, 0xcb, 0x68, 0xbc, 0xd7,
|
||||
0x64, 0xd4, 0xc3, 0x3a, 0x7e, 0xae, 0x8e, 0xaf, 0x04, 0x71, 0x69, 0x4d, 0xd0, 0xfd, 0xe0, 0xd5,
|
||||
0xe9, 0x76, 0xca, 0xaf, 0x9f, 0xaf, 0xb0, 0xd7, 0x38, 0xf2, 0xe0, 0xc7, 0x2e, 0xd5, 0x01, 0x15,
|
||||
0xef, 0xe2, 0x65, 0xed, 0x04, 0xf7, 0xaa, 0xc5, 0x35, 0xe5, 0x96, 0x1b, 0x5e, 0x66, 0xf5, 0x39,
|
||||
0xea, 0xbe, 0xfe, 0x03, 0x00, 0x00, 0xff, 0xff, 0x73, 0x63, 0xb7, 0xba, 0x0d, 0x01, 0x00, 0x00,
|
||||
}
|
||||
Generated
Vendored
+90
@@ -0,0 +1,90 @@
|
||||
// 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.rpc;
|
||||
|
||||
import "github.com/golang/protobuf/ptypes/any/any.proto"; // from google/protobuf/any.proto
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "StatusProto";
|
||||
option java_package = "com.google.rpc";
|
||||
|
||||
|
||||
// The `Status` type defines a logical error model that is suitable for different
|
||||
// programming environments, including REST APIs and RPC APIs. It is used by
|
||||
// [gRPC](https://github.com/grpc). The error model is designed to be:
|
||||
//
|
||||
// - Simple to use and understand for most users
|
||||
// - Flexible enough to meet unexpected needs
|
||||
//
|
||||
// # Overview
|
||||
//
|
||||
// The `Status` message contains three pieces of data: error code, error message,
|
||||
// and error details. The error code should be an enum value of
|
||||
// [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The
|
||||
// error message should be a developer-facing English message that helps
|
||||
// developers *understand* and *resolve* the error. If a localized user-facing
|
||||
// error message is needed, put the localized message in the error details or
|
||||
// localize it in the client. The optional error details may contain arbitrary
|
||||
// information about the error. There is a predefined set of error detail types
|
||||
// in the package `google.rpc` which can be used for common error conditions.
|
||||
//
|
||||
// # Language mapping
|
||||
//
|
||||
// The `Status` message is the logical representation of the error model, but it
|
||||
// is not necessarily the actual wire format. When the `Status` message is
|
||||
// exposed in different client libraries and different wire protocols, it can be
|
||||
// mapped differently. For example, it will likely be mapped to some exceptions
|
||||
// in Java, but more likely mapped to some error codes in C.
|
||||
//
|
||||
// # Other uses
|
||||
//
|
||||
// The error model and the `Status` message can be used in a variety of
|
||||
// environments, either with or without APIs, to provide a
|
||||
// consistent developer experience across different environments.
|
||||
//
|
||||
// Example uses of this error model include:
|
||||
//
|
||||
// - Partial errors. If a service needs to return partial errors to the client,
|
||||
// it may embed the `Status` in the normal response to indicate the partial
|
||||
// errors.
|
||||
//
|
||||
// - Workflow errors. A typical workflow has multiple steps. Each step may
|
||||
// have a `Status` message for error reporting purpose.
|
||||
//
|
||||
// - Batch operations. If a client uses batch request and batch response, the
|
||||
// `Status` message should be used directly inside batch response, one for
|
||||
// each error sub-response.
|
||||
//
|
||||
// - Asynchronous operations. If an API call embeds asynchronous operation
|
||||
// results in its response, the status of those operations should be
|
||||
// represented directly using the `Status` message.
|
||||
//
|
||||
// - Logging. If some API errors are stored in logs, the message `Status` could
|
||||
// be used directly after any stripping needed for security/privacy reasons.
|
||||
message Status {
|
||||
// The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
|
||||
int32 code = 1;
|
||||
|
||||
// A developer-facing error message, which should be in English. Any
|
||||
// user-facing error message should be localized and sent in the
|
||||
// [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
|
||||
string message = 2;
|
||||
|
||||
// A list of messages that carry the error details. There will be a
|
||||
// common set of message types for APIs to use.
|
||||
repeated google.protobuf.Any details = 3;
|
||||
}
|
||||
+295
@@ -0,0 +1,295 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/protobuf/api.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package descriptor is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
google.golang.org/genproto/protobuf/api.proto
|
||||
google.golang.org/genproto/protobuf/descriptor.proto
|
||||
google.golang.org/genproto/protobuf/field_mask.proto
|
||||
google.golang.org/genproto/protobuf/source_context.proto
|
||||
google.golang.org/genproto/protobuf/type.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Api
|
||||
Method
|
||||
Mixin
|
||||
FileDescriptorSet
|
||||
FileDescriptorProto
|
||||
DescriptorProto
|
||||
FieldDescriptorProto
|
||||
OneofDescriptorProto
|
||||
EnumDescriptorProto
|
||||
EnumValueDescriptorProto
|
||||
ServiceDescriptorProto
|
||||
MethodDescriptorProto
|
||||
FileOptions
|
||||
MessageOptions
|
||||
FieldOptions
|
||||
OneofOptions
|
||||
EnumOptions
|
||||
EnumValueOptions
|
||||
ServiceOptions
|
||||
MethodOptions
|
||||
UninterpretedOption
|
||||
SourceCodeInfo
|
||||
GeneratedCodeInfo
|
||||
FieldMask
|
||||
SourceContext
|
||||
Type
|
||||
Field
|
||||
Enum
|
||||
EnumValue
|
||||
Option
|
||||
*/
|
||||
package descriptor // import "google.golang.org/genproto/protobuf"
|
||||
|
||||
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
|
||||
|
||||
// Api is a light-weight descriptor for a protocol buffer service.
|
||||
type Api struct {
|
||||
// The fully qualified name of this api, including package name
|
||||
// followed by the api's simple name.
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// The methods of this api, in unspecified order.
|
||||
Methods []*Method `protobuf:"bytes,2,rep,name=methods" json:"methods,omitempty"`
|
||||
// Any metadata attached to the API.
|
||||
Options []*Option `protobuf:"bytes,3,rep,name=options" json:"options,omitempty"`
|
||||
// A version string for this api. If specified, must have the form
|
||||
// `major-version.minor-version`, as in `1.10`. If the minor version
|
||||
// is omitted, it defaults to zero. If the entire version field is
|
||||
// empty, the major version is derived from the package name, as
|
||||
// outlined below. If the field is not empty, the version in the
|
||||
// package name will be verified to be consistent with what is
|
||||
// provided here.
|
||||
//
|
||||
// The versioning schema uses [semantic
|
||||
// versioning](http://semver.org) where the major version number
|
||||
// indicates a breaking change and the minor version an additive,
|
||||
// non-breaking change. Both version numbers are signals to users
|
||||
// what to expect from different versions, and should be carefully
|
||||
// chosen based on the product plan.
|
||||
//
|
||||
// The major version is also reflected in the package name of the
|
||||
// API, which must end in `v<major-version>`, as in
|
||||
// `google.feature.v1`. For major versions 0 and 1, the suffix can
|
||||
// be omitted. Zero major versions must only be used for
|
||||
// experimental, none-GA apis.
|
||||
//
|
||||
//
|
||||
Version string `protobuf:"bytes,4,opt,name=version" json:"version,omitempty"`
|
||||
// Source context for the protocol buffer service represented by this
|
||||
// message.
|
||||
SourceContext *SourceContext `protobuf:"bytes,5,opt,name=source_context,json=sourceContext" json:"source_context,omitempty"`
|
||||
// Included APIs. See [Mixin][].
|
||||
Mixins []*Mixin `protobuf:"bytes,6,rep,name=mixins" json:"mixins,omitempty"`
|
||||
// The source syntax of the service.
|
||||
Syntax Syntax `protobuf:"varint,7,opt,name=syntax,enum=google.protobuf.Syntax" json:"syntax,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Api) Reset() { *m = Api{} }
|
||||
func (m *Api) String() string { return proto.CompactTextString(m) }
|
||||
func (*Api) ProtoMessage() {}
|
||||
func (*Api) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *Api) GetMethods() []*Method {
|
||||
if m != nil {
|
||||
return m.Methods
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Api) GetOptions() []*Option {
|
||||
if m != nil {
|
||||
return m.Options
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Api) GetSourceContext() *SourceContext {
|
||||
if m != nil {
|
||||
return m.SourceContext
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Api) GetMixins() []*Mixin {
|
||||
if m != nil {
|
||||
return m.Mixins
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Method represents a method of an api.
|
||||
type Method struct {
|
||||
// The simple name of this method.
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// A URL of the input message type.
|
||||
RequestTypeUrl string `protobuf:"bytes,2,opt,name=request_type_url,json=requestTypeUrl" json:"request_type_url,omitempty"`
|
||||
// If true, the request is streamed.
|
||||
RequestStreaming bool `protobuf:"varint,3,opt,name=request_streaming,json=requestStreaming" json:"request_streaming,omitempty"`
|
||||
// The URL of the output message type.
|
||||
ResponseTypeUrl string `protobuf:"bytes,4,opt,name=response_type_url,json=responseTypeUrl" json:"response_type_url,omitempty"`
|
||||
// If true, the response is streamed.
|
||||
ResponseStreaming bool `protobuf:"varint,5,opt,name=response_streaming,json=responseStreaming" json:"response_streaming,omitempty"`
|
||||
// Any metadata attached to the method.
|
||||
Options []*Option `protobuf:"bytes,6,rep,name=options" json:"options,omitempty"`
|
||||
// The source syntax of this method.
|
||||
Syntax Syntax `protobuf:"varint,7,opt,name=syntax,enum=google.protobuf.Syntax" json:"syntax,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Method) Reset() { *m = Method{} }
|
||||
func (m *Method) String() string { return proto.CompactTextString(m) }
|
||||
func (*Method) ProtoMessage() {}
|
||||
func (*Method) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
func (m *Method) GetOptions() []*Option {
|
||||
if m != nil {
|
||||
return m.Options
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Declares an API to be included in this API. The including API must
|
||||
// redeclare all the methods from the included API, but documentation
|
||||
// and options are inherited as follows:
|
||||
//
|
||||
// - If after comment and whitespace stripping, the documentation
|
||||
// string of the redeclared method is empty, it will be inherited
|
||||
// from the original method.
|
||||
//
|
||||
// - Each annotation belonging to the service config (http,
|
||||
// visibility) which is not set in the redeclared method will be
|
||||
// inherited.
|
||||
//
|
||||
// - If an http annotation is inherited, the path pattern will be
|
||||
// modified as follows. Any version prefix will be replaced by the
|
||||
// version of the including API plus the [root][] path if specified.
|
||||
//
|
||||
// Example of a simple mixin:
|
||||
//
|
||||
// package google.acl.v1;
|
||||
// service AccessControl {
|
||||
// // Get the underlying ACL object.
|
||||
// rpc GetAcl(GetAclRequest) returns (Acl) {
|
||||
// option (google.api.http).get = "/v1/{resource=**}:getAcl";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// package google.storage.v2;
|
||||
// service Storage {
|
||||
// rpc GetAcl(GetAclRequest) returns (Acl);
|
||||
//
|
||||
// // Get a data record.
|
||||
// rpc GetData(GetDataRequest) returns (Data) {
|
||||
// option (google.api.http).get = "/v2/{resource=**}";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Example of a mixin configuration:
|
||||
//
|
||||
// apis:
|
||||
// - name: google.storage.v2.Storage
|
||||
// mixins:
|
||||
// - name: google.acl.v1.AccessControl
|
||||
//
|
||||
// The mixin construct implies that all methods in `AccessControl` are
|
||||
// also declared with same name and request/response types in
|
||||
// `Storage`. A documentation generator or annotation processor will
|
||||
// see the effective `Storage.GetAcl` method after inherting
|
||||
// documentation and annotations as follows:
|
||||
//
|
||||
// service Storage {
|
||||
// // Get the underlying ACL object.
|
||||
// rpc GetAcl(GetAclRequest) returns (Acl) {
|
||||
// option (google.api.http).get = "/v2/{resource=**}:getAcl";
|
||||
// }
|
||||
// ...
|
||||
// }
|
||||
//
|
||||
// Note how the version in the path pattern changed from `v1` to `v2`.
|
||||
//
|
||||
// If the `root` field in the mixin is specified, it should be a
|
||||
// relative path under which inherited HTTP paths are placed. Example:
|
||||
//
|
||||
// apis:
|
||||
// - name: google.storage.v2.Storage
|
||||
// mixins:
|
||||
// - name: google.acl.v1.AccessControl
|
||||
// root: acls
|
||||
//
|
||||
// This implies the following inherited HTTP annotation:
|
||||
//
|
||||
// service Storage {
|
||||
// // Get the underlying ACL object.
|
||||
// rpc GetAcl(GetAclRequest) returns (Acl) {
|
||||
// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
|
||||
// }
|
||||
// ...
|
||||
// }
|
||||
type Mixin struct {
|
||||
// The fully qualified name of the API which is included.
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// If non-empty specifies a path under which inherited HTTP paths
|
||||
// are rooted.
|
||||
Root string `protobuf:"bytes,2,opt,name=root" json:"root,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Mixin) Reset() { *m = Mixin{} }
|
||||
func (m *Mixin) String() string { return proto.CompactTextString(m) }
|
||||
func (*Mixin) ProtoMessage() {}
|
||||
func (*Mixin) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Api)(nil), "google.protobuf.Api")
|
||||
proto.RegisterType((*Method)(nil), "google.protobuf.Method")
|
||||
proto.RegisterType((*Mixin)(nil), "google.protobuf.Mixin")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("google.golang.org/genproto/protobuf/api.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 424 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x52, 0x4f, 0x4f, 0xe2, 0x40,
|
||||
0x14, 0x4f, 0x5b, 0x28, 0xec, 0x90, 0x85, 0xdd, 0xd9, 0x64, 0xb7, 0xe1, 0x40, 0x08, 0xa7, 0x66,
|
||||
0x37, 0xb4, 0x59, 0xbc, 0x78, 0x15, 0x63, 0x38, 0x10, 0x63, 0x53, 0x34, 0x1e, 0x49, 0xc1, 0xb1,
|
||||
0x36, 0x69, 0x67, 0xea, 0xcc, 0x54, 0xe1, 0xdb, 0x18, 0x8f, 0x1e, 0xfd, 0x06, 0x7e, 0x33, 0xa7,
|
||||
0xd3, 0x0e, 0x20, 0x60, 0x82, 0x97, 0x66, 0xde, 0xfb, 0xfd, 0x79, 0xf3, 0x7e, 0x53, 0xd0, 0x0f,
|
||||
0x09, 0x09, 0x63, 0xe4, 0x84, 0x24, 0x0e, 0x70, 0xe8, 0x10, 0x1a, 0xba, 0x21, 0xc2, 0x29, 0x25,
|
||||
0x9c, 0xb8, 0xf2, 0x3b, 0xcb, 0x6e, 0xdd, 0x20, 0x8d, 0x1c, 0x59, 0xc0, 0x56, 0x49, 0x57, 0x50,
|
||||
0xfb, 0xf8, 0x10, 0x3d, 0x23, 0x19, 0x9d, 0xa3, 0xe9, 0x9c, 0x60, 0x8e, 0x16, 0xbc, 0x10, 0xb7,
|
||||
0x9d, 0x43, 0x94, 0x7c, 0x99, 0x96, 0xc3, 0x7a, 0x6f, 0x3a, 0x30, 0x4e, 0xd2, 0x08, 0x42, 0x50,
|
||||
0xc1, 0x41, 0x82, 0x2c, 0xad, 0xab, 0xd9, 0xdf, 0x7c, 0x79, 0x86, 0xff, 0x41, 0x2d, 0x41, 0xfc,
|
||||
0x8e, 0xdc, 0x30, 0x4b, 0xef, 0x1a, 0x76, 0x63, 0xf0, 0xc7, 0xd9, 0xba, 0xa8, 0x73, 0x2e, 0x71,
|
||||
0x5f, 0xf1, 0x72, 0x09, 0x49, 0x79, 0x44, 0x30, 0xb3, 0x8c, 0x4f, 0x24, 0x17, 0x12, 0xf7, 0x15,
|
||||
0x0f, 0x5a, 0xa0, 0xf6, 0x80, 0x28, 0x13, 0x67, 0xab, 0x22, 0x87, 0xab, 0x12, 0x9e, 0x81, 0xe6,
|
||||
0xc7, 0x1d, 0xad, 0xaa, 0x20, 0x34, 0x06, 0x9d, 0x1d, 0xcf, 0x89, 0xa4, 0x9d, 0x16, 0x2c, 0xff,
|
||||
0x3b, 0xdb, 0x2c, 0xa1, 0x03, 0xcc, 0x24, 0x5a, 0x44, 0xe2, 0x4a, 0xa6, 0xbc, 0xd2, 0xef, 0xdd,
|
||||
0x2d, 0x72, 0xd8, 0x2f, 0x59, 0xd0, 0x05, 0x26, 0x5b, 0x62, 0x1e, 0x2c, 0xac, 0x9a, 0x18, 0xd7,
|
||||
0xdc, 0xb3, 0xc2, 0x44, 0xc2, 0x7e, 0x49, 0xeb, 0xbd, 0xea, 0xc0, 0x2c, 0x82, 0xd8, 0x1b, 0xa3,
|
||||
0x0d, 0x7e, 0x50, 0x74, 0x9f, 0x21, 0xc6, 0xa7, 0x79, 0xf0, 0xd3, 0x8c, 0xc6, 0x22, 0xcf, 0x1c,
|
||||
0x6f, 0x96, 0xfd, 0x4b, 0xd1, 0xbe, 0xa2, 0x31, 0xfc, 0x07, 0x7e, 0x2a, 0x26, 0xe3, 0x14, 0x05,
|
||||
0x49, 0x84, 0x43, 0x91, 0xa3, 0x66, 0xd7, 0x7d, 0x65, 0x31, 0x51, 0x7d, 0xf8, 0x37, 0x27, 0xb3,
|
||||
0x54, 0x44, 0x88, 0xd6, 0xbe, 0x45, 0x82, 0x2d, 0x05, 0x28, 0xe3, 0x3e, 0x80, 0x2b, 0xee, 0xda,
|
||||
0xb9, 0x2a, 0x9d, 0x57, 0x2e, 0x6b, 0xeb, 0x8d, 0x57, 0x34, 0x0f, 0x7c, 0xc5, 0x2f, 0x87, 0xe6,
|
||||
0x82, 0xaa, 0x8c, 0x7d, 0x6f, 0x64, 0xa2, 0x47, 0x09, 0xe1, 0x65, 0x4c, 0xf2, 0x3c, 0x1c, 0x83,
|
||||
0x5f, 0x73, 0x92, 0x6c, 0xdb, 0x0e, 0xeb, 0xe2, 0xef, 0xf5, 0xf2, 0xc2, 0xd3, 0x9e, 0x34, 0xed,
|
||||
0x59, 0x37, 0x46, 0xde, 0xf0, 0x45, 0xef, 0x8c, 0x0a, 0x9a, 0xa7, 0xa6, 0x5f, 0xa3, 0x38, 0x1e,
|
||||
0x63, 0xf2, 0x88, 0xf3, 0x48, 0xd8, 0xcc, 0x94, 0xfa, 0xa3, 0xf7, 0x00, 0x00, 0x00, 0xff, 0xff,
|
||||
0x97, 0x07, 0xcf, 0x1c, 0xa9, 0x03, 0x00, 0x00,
|
||||
}
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
// 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;
|
||||
|
||||
import "google.golang.org/genproto/protobuf/source_context.proto"; // from google/protobuf/source_context.proto
|
||||
import "google.golang.org/genproto/protobuf/type.proto"; // from google/protobuf/type.proto
|
||||
|
||||
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||
option java_package = "com.google.protobuf";
|
||||
option java_outer_classname = "ApiProto";
|
||||
option java_multiple_files = true;
|
||||
option java_generate_equals_and_hash = true;
|
||||
option objc_class_prefix = "GPB";
|
||||
|
||||
// Api is a light-weight descriptor for a protocol buffer service.
|
||||
message Api {
|
||||
|
||||
// The fully qualified name of this api, including package name
|
||||
// followed by the api's simple name.
|
||||
string name = 1;
|
||||
|
||||
// The methods of this api, in unspecified order.
|
||||
repeated Method methods = 2;
|
||||
|
||||
// Any metadata attached to the API.
|
||||
repeated Option options = 3;
|
||||
|
||||
// A version string for this api. If specified, must have the form
|
||||
// `major-version.minor-version`, as in `1.10`. If the minor version
|
||||
// is omitted, it defaults to zero. If the entire version field is
|
||||
// empty, the major version is derived from the package name, as
|
||||
// outlined below. If the field is not empty, the version in the
|
||||
// package name will be verified to be consistent with what is
|
||||
// provided here.
|
||||
//
|
||||
// The versioning schema uses [semantic
|
||||
// versioning](http://semver.org) where the major version number
|
||||
// indicates a breaking change and the minor version an additive,
|
||||
// non-breaking change. Both version numbers are signals to users
|
||||
// what to expect from different versions, and should be carefully
|
||||
// chosen based on the product plan.
|
||||
//
|
||||
// The major version is also reflected in the package name of the
|
||||
// API, which must end in `v<major-version>`, as in
|
||||
// `google.feature.v1`. For major versions 0 and 1, the suffix can
|
||||
// be omitted. Zero major versions must only be used for
|
||||
// experimental, none-GA apis.
|
||||
//
|
||||
//
|
||||
string version = 4;
|
||||
|
||||
// Source context for the protocol buffer service represented by this
|
||||
// message.
|
||||
SourceContext source_context = 5;
|
||||
|
||||
// Included APIs. See [Mixin][].
|
||||
repeated Mixin mixins = 6;
|
||||
|
||||
// The source syntax of the service.
|
||||
Syntax syntax = 7;
|
||||
}
|
||||
|
||||
// Method represents a method of an api.
|
||||
message Method {
|
||||
|
||||
// The simple name of this method.
|
||||
string name = 1;
|
||||
|
||||
// A URL of the input message type.
|
||||
string request_type_url = 2;
|
||||
|
||||
// If true, the request is streamed.
|
||||
bool request_streaming = 3;
|
||||
|
||||
// The URL of the output message type.
|
||||
string response_type_url = 4;
|
||||
|
||||
// If true, the response is streamed.
|
||||
bool response_streaming = 5;
|
||||
|
||||
// Any metadata attached to the method.
|
||||
repeated Option options = 6;
|
||||
|
||||
// The source syntax of this method.
|
||||
Syntax syntax = 7;
|
||||
}
|
||||
|
||||
// Declares an API to be included in this API. The including API must
|
||||
// redeclare all the methods from the included API, but documentation
|
||||
// and options are inherited as follows:
|
||||
//
|
||||
// - If after comment and whitespace stripping, the documentation
|
||||
// string of the redeclared method is empty, it will be inherited
|
||||
// from the original method.
|
||||
//
|
||||
// - Each annotation belonging to the service config (http,
|
||||
// visibility) which is not set in the redeclared method will be
|
||||
// inherited.
|
||||
//
|
||||
// - If an http annotation is inherited, the path pattern will be
|
||||
// modified as follows. Any version prefix will be replaced by the
|
||||
// version of the including API plus the [root][] path if specified.
|
||||
//
|
||||
// Example of a simple mixin:
|
||||
//
|
||||
// package google.acl.v1;
|
||||
// service AccessControl {
|
||||
// // Get the underlying ACL object.
|
||||
// rpc GetAcl(GetAclRequest) returns (Acl) {
|
||||
// option (google.api.http).get = "/v1/{resource=**}:getAcl";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// package google.storage.v2;
|
||||
// service Storage {
|
||||
// rpc GetAcl(GetAclRequest) returns (Acl);
|
||||
//
|
||||
// // Get a data record.
|
||||
// rpc GetData(GetDataRequest) returns (Data) {
|
||||
// option (google.api.http).get = "/v2/{resource=**}";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Example of a mixin configuration:
|
||||
//
|
||||
// apis:
|
||||
// - name: google.storage.v2.Storage
|
||||
// mixins:
|
||||
// - name: google.acl.v1.AccessControl
|
||||
//
|
||||
// The mixin construct implies that all methods in `AccessControl` are
|
||||
// also declared with same name and request/response types in
|
||||
// `Storage`. A documentation generator or annotation processor will
|
||||
// see the effective `Storage.GetAcl` method after inherting
|
||||
// documentation and annotations as follows:
|
||||
//
|
||||
// service Storage {
|
||||
// // Get the underlying ACL object.
|
||||
// rpc GetAcl(GetAclRequest) returns (Acl) {
|
||||
// option (google.api.http).get = "/v2/{resource=**}:getAcl";
|
||||
// }
|
||||
// ...
|
||||
// }
|
||||
//
|
||||
// Note how the version in the path pattern changed from `v1` to `v2`.
|
||||
//
|
||||
// If the `root` field in the mixin is specified, it should be a
|
||||
// relative path under which inherited HTTP paths are placed. Example:
|
||||
//
|
||||
// apis:
|
||||
// - name: google.storage.v2.Storage
|
||||
// mixins:
|
||||
// - name: google.acl.v1.AccessControl
|
||||
// root: acls
|
||||
//
|
||||
// This implies the following inherited HTTP annotation:
|
||||
//
|
||||
// service Storage {
|
||||
// // Get the underlying ACL object.
|
||||
// rpc GetAcl(GetAclRequest) returns (Acl) {
|
||||
// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
|
||||
// }
|
||||
// ...
|
||||
// }
|
||||
message Mixin {
|
||||
// The fully qualified name of the API which is included.
|
||||
string name = 1;
|
||||
|
||||
// If non-empty specifies a path under which inherited HTTP paths
|
||||
// are rooted.
|
||||
string root = 2;
|
||||
}
|
||||
+2044
File diff suppressed because it is too large
Load Diff
+813
@@ -0,0 +1,813 @@
|
||||
// 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.
|
||||
|
||||
// Author: kenton@google.com (Kenton Varda)
|
||||
// Based on original Protocol Buffers design by
|
||||
// Sanjay Ghemawat, Jeff Dean, and others.
|
||||
//
|
||||
// The messages in this file describe the definitions found in .proto files.
|
||||
// A valid .proto file can be translated directly to a FileDescriptorProto
|
||||
// without any other information (e.g. without reading its imports).
|
||||
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package google.protobuf;
|
||||
option go_package = "descriptor";
|
||||
option java_package = "com.google.protobuf";
|
||||
option java_outer_classname = "DescriptorProtos";
|
||||
option csharp_namespace = "Google.Protobuf.Reflection";
|
||||
option objc_class_prefix = "GPB";
|
||||
option java_generate_equals_and_hash = true;
|
||||
|
||||
// descriptor.proto must be optimized for speed because reflection-based
|
||||
// algorithms don't work during bootstrapping.
|
||||
option optimize_for = SPEED;
|
||||
|
||||
// The protocol compiler can output a FileDescriptorSet containing the .proto
|
||||
// files it parses.
|
||||
message FileDescriptorSet {
|
||||
repeated FileDescriptorProto file = 1;
|
||||
}
|
||||
|
||||
// Describes a complete .proto file.
|
||||
message FileDescriptorProto {
|
||||
optional string name = 1; // file name, relative to root of source tree
|
||||
optional string package = 2; // e.g. "foo", "foo.bar", etc.
|
||||
|
||||
// Names of files imported by this file.
|
||||
repeated string dependency = 3;
|
||||
// Indexes of the public imported files in the dependency list above.
|
||||
repeated int32 public_dependency = 10;
|
||||
// Indexes of the weak imported files in the dependency list.
|
||||
// For Google-internal migration only. Do not use.
|
||||
repeated int32 weak_dependency = 11;
|
||||
|
||||
// All top-level definitions in this file.
|
||||
repeated DescriptorProto message_type = 4;
|
||||
repeated EnumDescriptorProto enum_type = 5;
|
||||
repeated ServiceDescriptorProto service = 6;
|
||||
repeated FieldDescriptorProto extension = 7;
|
||||
|
||||
optional FileOptions options = 8;
|
||||
|
||||
// This field contains optional information about the original source code.
|
||||
// You may safely remove this entire field without harming runtime
|
||||
// functionality of the descriptors -- the information is needed only by
|
||||
// development tools.
|
||||
optional SourceCodeInfo source_code_info = 9;
|
||||
|
||||
// The syntax of the proto file.
|
||||
// The supported values are "proto2" and "proto3".
|
||||
optional string syntax = 12;
|
||||
}
|
||||
|
||||
// Describes a message type.
|
||||
message DescriptorProto {
|
||||
optional string name = 1;
|
||||
|
||||
repeated FieldDescriptorProto field = 2;
|
||||
repeated FieldDescriptorProto extension = 6;
|
||||
|
||||
repeated DescriptorProto nested_type = 3;
|
||||
repeated EnumDescriptorProto enum_type = 4;
|
||||
|
||||
message ExtensionRange {
|
||||
optional int32 start = 1;
|
||||
optional int32 end = 2;
|
||||
}
|
||||
repeated ExtensionRange extension_range = 5;
|
||||
|
||||
repeated OneofDescriptorProto oneof_decl = 8;
|
||||
|
||||
optional MessageOptions options = 7;
|
||||
|
||||
// Range of reserved tag numbers. Reserved tag numbers may not be used by
|
||||
// fields or extension ranges in the same message. Reserved ranges may
|
||||
// not overlap.
|
||||
message ReservedRange {
|
||||
optional int32 start = 1; // Inclusive.
|
||||
optional int32 end = 2; // Exclusive.
|
||||
}
|
||||
repeated ReservedRange reserved_range = 9;
|
||||
// Reserved field names, which may not be used by fields in the same message.
|
||||
// A given name may only be reserved once.
|
||||
repeated string reserved_name = 10;
|
||||
}
|
||||
|
||||
// Describes a field within a message.
|
||||
message FieldDescriptorProto {
|
||||
enum Type {
|
||||
// 0 is reserved for errors.
|
||||
// Order is weird for historical reasons.
|
||||
TYPE_DOUBLE = 1;
|
||||
TYPE_FLOAT = 2;
|
||||
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
|
||||
// negative values are likely.
|
||||
TYPE_INT64 = 3;
|
||||
TYPE_UINT64 = 4;
|
||||
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
|
||||
// negative values are likely.
|
||||
TYPE_INT32 = 5;
|
||||
TYPE_FIXED64 = 6;
|
||||
TYPE_FIXED32 = 7;
|
||||
TYPE_BOOL = 8;
|
||||
TYPE_STRING = 9;
|
||||
TYPE_GROUP = 10; // Tag-delimited aggregate.
|
||||
TYPE_MESSAGE = 11; // Length-delimited aggregate.
|
||||
|
||||
// New in version 2.
|
||||
TYPE_BYTES = 12;
|
||||
TYPE_UINT32 = 13;
|
||||
TYPE_ENUM = 14;
|
||||
TYPE_SFIXED32 = 15;
|
||||
TYPE_SFIXED64 = 16;
|
||||
TYPE_SINT32 = 17; // Uses ZigZag encoding.
|
||||
TYPE_SINT64 = 18; // Uses ZigZag encoding.
|
||||
};
|
||||
|
||||
enum Label {
|
||||
// 0 is reserved for errors
|
||||
LABEL_OPTIONAL = 1;
|
||||
LABEL_REQUIRED = 2;
|
||||
LABEL_REPEATED = 3;
|
||||
// TODO(sanjay): Should we add LABEL_MAP?
|
||||
};
|
||||
|
||||
optional string name = 1;
|
||||
optional int32 number = 3;
|
||||
optional Label label = 4;
|
||||
|
||||
// If type_name is set, this need not be set. If both this and type_name
|
||||
// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
|
||||
optional Type type = 5;
|
||||
|
||||
// For message and enum types, this is the name of the type. If the name
|
||||
// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
|
||||
// rules are used to find the type (i.e. first the nested types within this
|
||||
// message are searched, then within the parent, on up to the root
|
||||
// namespace).
|
||||
optional string type_name = 6;
|
||||
|
||||
// For extensions, this is the name of the type being extended. It is
|
||||
// resolved in the same manner as type_name.
|
||||
optional string extendee = 2;
|
||||
|
||||
// For numeric types, contains the original text representation of the value.
|
||||
// For booleans, "true" or "false".
|
||||
// For strings, contains the default text contents (not escaped in any way).
|
||||
// For bytes, contains the C escaped value. All bytes >= 128 are escaped.
|
||||
// TODO(kenton): Base-64 encode?
|
||||
optional string default_value = 7;
|
||||
|
||||
// If set, gives the index of a oneof in the containing type's oneof_decl
|
||||
// list. This field is a member of that oneof.
|
||||
optional int32 oneof_index = 9;
|
||||
|
||||
// JSON name of this field. The value is set by protocol compiler. If the
|
||||
// user has set a "json_name" option on this field, that option's value
|
||||
// will be used. Otherwise, it's deduced from the field's name by converting
|
||||
// it to camelCase.
|
||||
optional string json_name = 10;
|
||||
|
||||
optional FieldOptions options = 8;
|
||||
}
|
||||
|
||||
// Describes a oneof.
|
||||
message OneofDescriptorProto {
|
||||
optional string name = 1;
|
||||
optional OneofOptions options = 2;
|
||||
}
|
||||
|
||||
// Describes an enum type.
|
||||
message EnumDescriptorProto {
|
||||
optional string name = 1;
|
||||
|
||||
repeated EnumValueDescriptorProto value = 2;
|
||||
|
||||
optional EnumOptions options = 3;
|
||||
}
|
||||
|
||||
// Describes a value within an enum.
|
||||
message EnumValueDescriptorProto {
|
||||
optional string name = 1;
|
||||
optional int32 number = 2;
|
||||
|
||||
optional EnumValueOptions options = 3;
|
||||
}
|
||||
|
||||
// Describes a service.
|
||||
message ServiceDescriptorProto {
|
||||
optional string name = 1;
|
||||
repeated MethodDescriptorProto method = 2;
|
||||
|
||||
optional ServiceOptions options = 3;
|
||||
}
|
||||
|
||||
// Describes a method of a service.
|
||||
message MethodDescriptorProto {
|
||||
optional string name = 1;
|
||||
|
||||
// Input and output type names. These are resolved in the same way as
|
||||
// FieldDescriptorProto.type_name, but must refer to a message type.
|
||||
optional string input_type = 2;
|
||||
optional string output_type = 3;
|
||||
|
||||
optional MethodOptions options = 4;
|
||||
|
||||
// Identifies if client streams multiple client messages
|
||||
optional bool client_streaming = 5 [default=false];
|
||||
// Identifies if server streams multiple server messages
|
||||
optional bool server_streaming = 6 [default=false];
|
||||
}
|
||||
|
||||
|
||||
// ===================================================================
|
||||
// Options
|
||||
|
||||
// Each of the definitions above may have "options" attached. These are
|
||||
// just annotations which may cause code to be generated slightly differently
|
||||
// or may contain hints for code that manipulates protocol messages.
|
||||
//
|
||||
// Clients may define custom options as extensions of the *Options messages.
|
||||
// These extensions may not yet be known at parsing time, so the parser cannot
|
||||
// store the values in them. Instead it stores them in a field in the *Options
|
||||
// message called uninterpreted_option. This field must have the same name
|
||||
// across all *Options messages. We then use this field to populate the
|
||||
// extensions when we build a descriptor, at which point all protos have been
|
||||
// parsed and so all extensions are known.
|
||||
//
|
||||
// Extension numbers for custom options may be chosen as follows:
|
||||
// * For options which will only be used within a single application or
|
||||
// organization, or for experimental options, use field numbers 50000
|
||||
// through 99999. It is up to you to ensure that you do not use the
|
||||
// same number for multiple options.
|
||||
// * For options which will be published and used publicly by multiple
|
||||
// independent entities, e-mail protobuf-global-extension-registry@google.com
|
||||
// to reserve extension numbers. Simply provide your project name (e.g.
|
||||
// Objective-C plugin) and your project website (if available) -- there's no
|
||||
// need to explain how you intend to use them. Usually you only need one
|
||||
// extension number. You can declare multiple options with only one extension
|
||||
// number by putting them in a sub-message. See the Custom Options section of
|
||||
// the docs for examples:
|
||||
// https://developers.google.com/protocol-buffers/docs/proto#options
|
||||
// If this turns out to be popular, a web service will be set up
|
||||
// to automatically assign option numbers.
|
||||
|
||||
|
||||
message FileOptions {
|
||||
|
||||
// Sets the Java package where classes generated from this .proto will be
|
||||
// placed. By default, the proto package is used, but this is often
|
||||
// inappropriate because proto packages do not normally start with backwards
|
||||
// domain names.
|
||||
optional string java_package = 1;
|
||||
|
||||
|
||||
// If set, all the classes from the .proto file are wrapped in a single
|
||||
// outer class with the given name. This applies to both Proto1
|
||||
// (equivalent to the old "--one_java_file" option) and Proto2 (where
|
||||
// a .proto always translates to a single class, but you may want to
|
||||
// explicitly choose the class name).
|
||||
optional string java_outer_classname = 8;
|
||||
|
||||
// If set true, then the Java code generator will generate a separate .java
|
||||
// file for each top-level message, enum, and service defined in the .proto
|
||||
// file. Thus, these types will *not* be nested inside the outer class
|
||||
// named by java_outer_classname. However, the outer class will still be
|
||||
// generated to contain the file's getDescriptor() method as well as any
|
||||
// top-level extensions defined in the file.
|
||||
optional bool java_multiple_files = 10 [default=false];
|
||||
|
||||
// If set true, then the Java code generator will generate equals() and
|
||||
// hashCode() methods for all messages defined in the .proto file.
|
||||
// This increases generated code size, potentially substantially for large
|
||||
// protos, which may harm a memory-constrained application.
|
||||
// - In the full runtime this is a speed optimization, as the
|
||||
// AbstractMessage base class includes reflection-based implementations of
|
||||
// these methods.
|
||||
// - In the lite runtime, setting this option changes the semantics of
|
||||
// equals() and hashCode() to more closely match those of the full runtime;
|
||||
// the generated methods compute their results based on field values rather
|
||||
// than object identity. (Implementations should not assume that hashcodes
|
||||
// will be consistent across runtimes or versions of the protocol compiler.)
|
||||
optional bool java_generate_equals_and_hash = 20 [default=false];
|
||||
|
||||
// If set true, then the Java2 code generator will generate code that
|
||||
// throws an exception whenever an attempt is made to assign a non-UTF-8
|
||||
// byte sequence to a string field.
|
||||
// Message reflection will do the same.
|
||||
// However, an extension field still accepts non-UTF-8 byte sequences.
|
||||
// This option has no effect on when used with the lite runtime.
|
||||
optional bool java_string_check_utf8 = 27 [default=false];
|
||||
|
||||
|
||||
// Generated classes can be optimized for speed or code size.
|
||||
enum OptimizeMode {
|
||||
SPEED = 1; // Generate complete code for parsing, serialization,
|
||||
// etc.
|
||||
CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
|
||||
LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
|
||||
}
|
||||
optional OptimizeMode optimize_for = 9 [default=SPEED];
|
||||
|
||||
// Sets the Go package where structs generated from this .proto will be
|
||||
// placed. If omitted, the Go package will be derived from the following:
|
||||
// - The basename of the package import path, if provided.
|
||||
// - Otherwise, the package statement in the .proto file, if present.
|
||||
// - Otherwise, the basename of the .proto file, without extension.
|
||||
optional string go_package = 11;
|
||||
|
||||
|
||||
|
||||
// Should generic services be generated in each language? "Generic" services
|
||||
// are not specific to any particular RPC system. They are generated by the
|
||||
// main code generators in each language (without additional plugins).
|
||||
// Generic services were the only kind of service generation supported by
|
||||
// early versions of google.protobuf.
|
||||
//
|
||||
// Generic services are now considered deprecated in favor of using plugins
|
||||
// that generate code specific to your particular RPC system. Therefore,
|
||||
// these default to false. Old code which depends on generic services should
|
||||
// explicitly set them to true.
|
||||
optional bool cc_generic_services = 16 [default=false];
|
||||
optional bool java_generic_services = 17 [default=false];
|
||||
optional bool py_generic_services = 18 [default=false];
|
||||
|
||||
// Is this file deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for everything in the file, or it will be completely ignored; in the very
|
||||
// least, this is a formalization for deprecating files.
|
||||
optional bool deprecated = 23 [default=false];
|
||||
|
||||
// Enables the use of arenas for the proto messages in this file. This applies
|
||||
// only to generated classes for C++.
|
||||
optional bool cc_enable_arenas = 31 [default=false];
|
||||
|
||||
|
||||
// Sets the objective c class prefix which is prepended to all objective c
|
||||
// generated classes from this .proto. There is no default.
|
||||
optional string objc_class_prefix = 36;
|
||||
|
||||
// Namespace for generated classes; defaults to the package.
|
||||
optional string csharp_namespace = 37;
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
|
||||
reserved 38;
|
||||
}
|
||||
|
||||
message MessageOptions {
|
||||
// Set true to use the old proto1 MessageSet wire format for extensions.
|
||||
// This is provided for backwards-compatibility with the MessageSet wire
|
||||
// format. You should not use this for any other reason: It's less
|
||||
// efficient, has fewer features, and is more complicated.
|
||||
//
|
||||
// The message must be defined exactly as follows:
|
||||
// message Foo {
|
||||
// option message_set_wire_format = true;
|
||||
// extensions 4 to max;
|
||||
// }
|
||||
// Note that the message cannot have any defined fields; MessageSets only
|
||||
// have extensions.
|
||||
//
|
||||
// All extensions of your type must be singular messages; e.g. they cannot
|
||||
// be int32s, enums, or repeated messages.
|
||||
//
|
||||
// Because this is an option, the above two restrictions are not enforced by
|
||||
// the protocol compiler.
|
||||
optional bool message_set_wire_format = 1 [default=false];
|
||||
|
||||
// Disables the generation of the standard "descriptor()" accessor, which can
|
||||
// conflict with a field of the same name. This is meant to make migration
|
||||
// from proto1 easier; new code should avoid fields named "descriptor".
|
||||
optional bool no_standard_descriptor_accessor = 2 [default=false];
|
||||
|
||||
// Is this message deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the message, or it will be completely ignored; in the very least,
|
||||
// this is a formalization for deprecating messages.
|
||||
optional bool deprecated = 3 [default=false];
|
||||
|
||||
// Whether the message is an automatically generated map entry type for the
|
||||
// maps field.
|
||||
//
|
||||
// For maps fields:
|
||||
// map<KeyType, ValueType> map_field = 1;
|
||||
// The parsed descriptor looks like:
|
||||
// message MapFieldEntry {
|
||||
// option map_entry = true;
|
||||
// optional KeyType key = 1;
|
||||
// optional ValueType value = 2;
|
||||
// }
|
||||
// repeated MapFieldEntry map_field = 1;
|
||||
//
|
||||
// Implementations may choose not to generate the map_entry=true message, but
|
||||
// use a native map in the target language to hold the keys and values.
|
||||
// The reflection APIs in such implementions still need to work as
|
||||
// if the field is a repeated message field.
|
||||
//
|
||||
// NOTE: Do not set the option in .proto files. Always use the maps syntax
|
||||
// instead. The option should only be implicitly set by the proto compiler
|
||||
// parser.
|
||||
optional bool map_entry = 7;
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
message FieldOptions {
|
||||
// The ctype option instructs the C++ code generator to use a different
|
||||
// representation of the field than it normally would. See the specific
|
||||
// options below. This option is not yet implemented in the open source
|
||||
// release -- sorry, we'll try to include it in a future version!
|
||||
optional CType ctype = 1 [default = STRING];
|
||||
enum CType {
|
||||
// Default mode.
|
||||
STRING = 0;
|
||||
|
||||
CORD = 1;
|
||||
|
||||
STRING_PIECE = 2;
|
||||
}
|
||||
// The packed option can be enabled for repeated primitive fields to enable
|
||||
// a more efficient representation on the wire. Rather than repeatedly
|
||||
// writing the tag and type for each element, the entire array is encoded as
|
||||
// a single length-delimited blob. In proto3, only explicit setting it to
|
||||
// false will avoid using packed encoding.
|
||||
optional bool packed = 2;
|
||||
|
||||
|
||||
// The jstype option determines the JavaScript type used for values of the
|
||||
// field. The option is permitted only for 64 bit integral and fixed types
|
||||
// (int64, uint64, sint64, fixed64, sfixed64). By default these types are
|
||||
// represented as JavaScript strings. This avoids loss of precision that can
|
||||
// happen when a large value is converted to a floating point JavaScript
|
||||
// numbers. Specifying JS_NUMBER for the jstype causes the generated
|
||||
// JavaScript code to use the JavaScript "number" type instead of strings.
|
||||
// This option is an enum to permit additional types to be added,
|
||||
// e.g. goog.math.Integer.
|
||||
optional JSType jstype = 6 [default = JS_NORMAL];
|
||||
enum JSType {
|
||||
// Use the default type.
|
||||
JS_NORMAL = 0;
|
||||
|
||||
// Use JavaScript strings.
|
||||
JS_STRING = 1;
|
||||
|
||||
// Use JavaScript numbers.
|
||||
JS_NUMBER = 2;
|
||||
}
|
||||
|
||||
// Should this field be parsed lazily? Lazy applies only to message-type
|
||||
// fields. It means that when the outer message is initially parsed, the
|
||||
// inner message's contents will not be parsed but instead stored in encoded
|
||||
// form. The inner message will actually be parsed when it is first accessed.
|
||||
//
|
||||
// This is only a hint. Implementations are free to choose whether to use
|
||||
// eager or lazy parsing regardless of the value of this option. However,
|
||||
// setting this option true suggests that the protocol author believes that
|
||||
// using lazy parsing on this field is worth the additional bookkeeping
|
||||
// overhead typically needed to implement it.
|
||||
//
|
||||
// This option does not affect the public interface of any generated code;
|
||||
// all method signatures remain the same. Furthermore, thread-safety of the
|
||||
// interface is not affected by this option; const methods remain safe to
|
||||
// call from multiple threads concurrently, while non-const methods continue
|
||||
// to require exclusive access.
|
||||
//
|
||||
//
|
||||
// Note that implementations may choose not to check required fields within
|
||||
// a lazy sub-message. That is, calling IsInitialized() on the outher message
|
||||
// may return true even if the inner message has missing required fields.
|
||||
// This is necessary because otherwise the inner message would have to be
|
||||
// parsed in order to perform the check, defeating the purpose of lazy
|
||||
// parsing. An implementation which chooses not to check required fields
|
||||
// must be consistent about it. That is, for any particular sub-message, the
|
||||
// implementation must either *always* check its required fields, or *never*
|
||||
// check its required fields, regardless of whether or not the message has
|
||||
// been parsed.
|
||||
optional bool lazy = 5 [default=false];
|
||||
|
||||
// Is this field deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for accessors, or it will be completely ignored; in the very least, this
|
||||
// is a formalization for deprecating fields.
|
||||
optional bool deprecated = 3 [default=false];
|
||||
|
||||
// For Google-internal migration only. Do not use.
|
||||
optional bool weak = 10 [default=false];
|
||||
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
message OneofOptions {
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
message EnumOptions {
|
||||
|
||||
// Set this option to true to allow mapping different tag names to the same
|
||||
// value.
|
||||
optional bool allow_alias = 2;
|
||||
|
||||
// Is this enum deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the enum, or it will be completely ignored; in the very least, this
|
||||
// is a formalization for deprecating enums.
|
||||
optional bool deprecated = 3 [default=false];
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
message EnumValueOptions {
|
||||
// Is this enum value deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the enum value, or it will be completely ignored; in the very least,
|
||||
// this is a formalization for deprecating enum values.
|
||||
optional bool deprecated = 1 [default=false];
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
message ServiceOptions {
|
||||
|
||||
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC
|
||||
// framework. We apologize for hoarding these numbers to ourselves, but
|
||||
// we were already using them long before we decided to release Protocol
|
||||
// Buffers.
|
||||
|
||||
// Is this service deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the service, or it will be completely ignored; in the very least,
|
||||
// this is a formalization for deprecating services.
|
||||
optional bool deprecated = 33 [default=false];
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
message MethodOptions {
|
||||
|
||||
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC
|
||||
// framework. We apologize for hoarding these numbers to ourselves, but
|
||||
// we were already using them long before we decided to release Protocol
|
||||
// Buffers.
|
||||
|
||||
// Is this method deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the method, or it will be completely ignored; in the very least,
|
||||
// this is a formalization for deprecating methods.
|
||||
optional bool deprecated = 33 [default=false];
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
|
||||
// A message representing a option the parser does not recognize. This only
|
||||
// appears in options protos created by the compiler::Parser class.
|
||||
// DescriptorPool resolves these when building Descriptor objects. Therefore,
|
||||
// options protos in descriptor objects (e.g. returned by Descriptor::options(),
|
||||
// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
|
||||
// in them.
|
||||
message UninterpretedOption {
|
||||
// The name of the uninterpreted option. Each string represents a segment in
|
||||
// a dot-separated name. is_extension is true iff a segment represents an
|
||||
// extension (denoted with parentheses in options specs in .proto files).
|
||||
// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
|
||||
// "foo.(bar.baz).qux".
|
||||
message NamePart {
|
||||
required string name_part = 1;
|
||||
required bool is_extension = 2;
|
||||
}
|
||||
repeated NamePart name = 2;
|
||||
|
||||
// The value of the uninterpreted option, in whatever type the tokenizer
|
||||
// identified it as during parsing. Exactly one of these should be set.
|
||||
optional string identifier_value = 3;
|
||||
optional uint64 positive_int_value = 4;
|
||||
optional int64 negative_int_value = 5;
|
||||
optional double double_value = 6;
|
||||
optional bytes string_value = 7;
|
||||
optional string aggregate_value = 8;
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
// Optional source code info
|
||||
|
||||
// Encapsulates information about the original source file from which a
|
||||
// FileDescriptorProto was generated.
|
||||
message SourceCodeInfo {
|
||||
// A Location identifies a piece of source code in a .proto file which
|
||||
// corresponds to a particular definition. This information is intended
|
||||
// to be useful to IDEs, code indexers, documentation generators, and similar
|
||||
// tools.
|
||||
//
|
||||
// For example, say we have a file like:
|
||||
// message Foo {
|
||||
// optional string foo = 1;
|
||||
// }
|
||||
// Let's look at just the field definition:
|
||||
// optional string foo = 1;
|
||||
// ^ ^^ ^^ ^ ^^^
|
||||
// a bc de f ghi
|
||||
// We have the following locations:
|
||||
// span path represents
|
||||
// [a,i) [ 4, 0, 2, 0 ] The whole field definition.
|
||||
// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
|
||||
// [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
|
||||
// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
|
||||
// [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
|
||||
//
|
||||
// Notes:
|
||||
// - A location may refer to a repeated field itself (i.e. not to any
|
||||
// particular index within it). This is used whenever a set of elements are
|
||||
// logically enclosed in a single code segment. For example, an entire
|
||||
// extend block (possibly containing multiple extension definitions) will
|
||||
// have an outer location whose path refers to the "extensions" repeated
|
||||
// field without an index.
|
||||
// - Multiple locations may have the same path. This happens when a single
|
||||
// logical declaration is spread out across multiple places. The most
|
||||
// obvious example is the "extend" block again -- there may be multiple
|
||||
// extend blocks in the same scope, each of which will have the same path.
|
||||
// - A location's span is not always a subset of its parent's span. For
|
||||
// example, the "extendee" of an extension declaration appears at the
|
||||
// beginning of the "extend" block and is shared by all extensions within
|
||||
// the block.
|
||||
// - Just because a location's span is a subset of some other location's span
|
||||
// does not mean that it is a descendent. For example, a "group" defines
|
||||
// both a type and a field in a single declaration. Thus, the locations
|
||||
// corresponding to the type and field and their components will overlap.
|
||||
// - Code which tries to interpret locations should probably be designed to
|
||||
// ignore those that it doesn't understand, as more types of locations could
|
||||
// be recorded in the future.
|
||||
repeated Location location = 1;
|
||||
message Location {
|
||||
// Identifies which part of the FileDescriptorProto was defined at this
|
||||
// location.
|
||||
//
|
||||
// Each element is a field number or an index. They form a path from
|
||||
// the root FileDescriptorProto to the place where the definition. For
|
||||
// example, this path:
|
||||
// [ 4, 3, 2, 7, 1 ]
|
||||
// refers to:
|
||||
// file.message_type(3) // 4, 3
|
||||
// .field(7) // 2, 7
|
||||
// .name() // 1
|
||||
// This is because FileDescriptorProto.message_type has field number 4:
|
||||
// repeated DescriptorProto message_type = 4;
|
||||
// and DescriptorProto.field has field number 2:
|
||||
// repeated FieldDescriptorProto field = 2;
|
||||
// and FieldDescriptorProto.name has field number 1:
|
||||
// optional string name = 1;
|
||||
//
|
||||
// Thus, the above path gives the location of a field name. If we removed
|
||||
// the last element:
|
||||
// [ 4, 3, 2, 7 ]
|
||||
// this path refers to the whole field declaration (from the beginning
|
||||
// of the label to the terminating semicolon).
|
||||
repeated int32 path = 1 [packed=true];
|
||||
|
||||
// Always has exactly three or four elements: start line, start column,
|
||||
// end line (optional, otherwise assumed same as start line), end column.
|
||||
// These are packed into a single field for efficiency. Note that line
|
||||
// and column numbers are zero-based -- typically you will want to add
|
||||
// 1 to each before displaying to a user.
|
||||
repeated int32 span = 2 [packed=true];
|
||||
|
||||
// If this SourceCodeInfo represents a complete declaration, these are any
|
||||
// comments appearing before and after the declaration which appear to be
|
||||
// attached to the declaration.
|
||||
//
|
||||
// A series of line comments appearing on consecutive lines, with no other
|
||||
// tokens appearing on those lines, will be treated as a single comment.
|
||||
//
|
||||
// leading_detached_comments will keep paragraphs of comments that appear
|
||||
// before (but not connected to) the current element. Each paragraph,
|
||||
// separated by empty lines, will be one comment element in the repeated
|
||||
// field.
|
||||
//
|
||||
// Only the comment content is provided; comment markers (e.g. //) are
|
||||
// stripped out. For block comments, leading whitespace and an asterisk
|
||||
// will be stripped from the beginning of each line other than the first.
|
||||
// Newlines are included in the output.
|
||||
//
|
||||
// Examples:
|
||||
//
|
||||
// optional int32 foo = 1; // Comment attached to foo.
|
||||
// // Comment attached to bar.
|
||||
// optional int32 bar = 2;
|
||||
//
|
||||
// optional string baz = 3;
|
||||
// // Comment attached to baz.
|
||||
// // Another line attached to baz.
|
||||
//
|
||||
// // Comment attached to qux.
|
||||
// //
|
||||
// // Another line attached to qux.
|
||||
// optional double qux = 4;
|
||||
//
|
||||
// // Detached comment for corge. This is not leading or trailing comments
|
||||
// // to qux or corge because there are blank lines separating it from
|
||||
// // both.
|
||||
//
|
||||
// // Detached comment for corge paragraph 2.
|
||||
//
|
||||
// optional string corge = 5;
|
||||
// /* Block comment attached
|
||||
// * to corge. Leading asterisks
|
||||
// * will be removed. */
|
||||
// /* Block comment attached to
|
||||
// * grault. */
|
||||
// optional int32 grault = 6;
|
||||
//
|
||||
// // ignored detached comments.
|
||||
optional string leading_comments = 3;
|
||||
optional string trailing_comments = 4;
|
||||
repeated string leading_detached_comments = 6;
|
||||
}
|
||||
}
|
||||
|
||||
// Describes the relationship between generated code and its original source
|
||||
// file. A GeneratedCodeInfo message is associated with only one generated
|
||||
// source file, but may contain references to different source .proto files.
|
||||
message GeneratedCodeInfo {
|
||||
// An Annotation connects some span of text in generated code to an element
|
||||
// of its generating .proto file.
|
||||
repeated Annotation annotation = 1;
|
||||
message Annotation {
|
||||
// Identifies the element in the original source .proto file. This field
|
||||
// is formatted the same as SourceCodeInfo.Location.path.
|
||||
repeated int32 path = 1 [packed=true];
|
||||
|
||||
// Identifies the filesystem path to the original source .proto.
|
||||
optional string source_file = 2;
|
||||
|
||||
// Identifies the starting offset in bytes in the generated code
|
||||
// that relates to the identified object.
|
||||
optional int32 begin = 3;
|
||||
|
||||
// Identifies the ending offset in bytes in the generated code that
|
||||
// relates to the identified offset. The end offset should be one past
|
||||
// the last relevant byte (so the length of the text = end - begin).
|
||||
optional int32 end = 4;
|
||||
}
|
||||
}
|
||||
+248
@@ -0,0 +1,248 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/protobuf/field_mask.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package descriptor // import "google.golang.org/genproto/protobuf"
|
||||
|
||||
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
|
||||
|
||||
// `FieldMask` represents a set of symbolic field paths, for example:
|
||||
//
|
||||
// paths: "f.a"
|
||||
// paths: "f.b.d"
|
||||
//
|
||||
// Here `f` represents a field in some root message, `a` and `b`
|
||||
// fields in the message found in `f`, and `d` a field found in the
|
||||
// message in `f.b`.
|
||||
//
|
||||
// Field masks are used to specify a subset of fields that should be
|
||||
// returned by a get operation or modified by an update operation.
|
||||
// Field masks also have a custom JSON encoding (see below).
|
||||
//
|
||||
// # Field Masks in Projections
|
||||
//
|
||||
// When used in the context of a projection, a response message or
|
||||
// sub-message is filtered by the API to only contain those fields as
|
||||
// specified in the mask. For example, if the mask in the previous
|
||||
// example is applied to a response message as follows:
|
||||
//
|
||||
// f {
|
||||
// a : 22
|
||||
// b {
|
||||
// d : 1
|
||||
// x : 2
|
||||
// }
|
||||
// y : 13
|
||||
// }
|
||||
// z: 8
|
||||
//
|
||||
// The result will not contain specific values for fields x,y and z
|
||||
// (their value will be set to the default, and omitted in proto text
|
||||
// output):
|
||||
//
|
||||
//
|
||||
// f {
|
||||
// a : 22
|
||||
// b {
|
||||
// d : 1
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// A repeated field is not allowed except at the last position of a
|
||||
// field mask.
|
||||
//
|
||||
// If a FieldMask object is not present in a get operation, the
|
||||
// operation applies to all fields (as if a FieldMask of all fields
|
||||
// had been specified).
|
||||
//
|
||||
// Note that a field mask does not necessarily apply to the
|
||||
// top-level response message. In case of a REST get operation, the
|
||||
// field mask applies directly to the response, but in case of a REST
|
||||
// list operation, the mask instead applies to each individual message
|
||||
// in the returned resource list. In case of a REST custom method,
|
||||
// other definitions may be used. Where the mask applies will be
|
||||
// clearly documented together with its declaration in the API. In
|
||||
// any case, the effect on the returned resource/resources is required
|
||||
// behavior for APIs.
|
||||
//
|
||||
// # Field Masks in Update Operations
|
||||
//
|
||||
// A field mask in update operations specifies which fields of the
|
||||
// targeted resource are going to be updated. The API is required
|
||||
// to only change the values of the fields as specified in the mask
|
||||
// and leave the others untouched. If a resource is passed in to
|
||||
// describe the updated values, the API ignores the values of all
|
||||
// fields not covered by the mask.
|
||||
//
|
||||
// If a repeated field is specified for an update operation, the existing
|
||||
// repeated values in the target resource will be overwritten by the new values.
|
||||
// Note that a repeated field is only allowed in the last position of a field
|
||||
// mask.
|
||||
//
|
||||
// If a sub-message is specified in the last position of the field mask for an
|
||||
// update operation, then the existing sub-message in the target resource is
|
||||
// overwritten. Given the target message:
|
||||
//
|
||||
// f {
|
||||
// b {
|
||||
// d : 1
|
||||
// x : 2
|
||||
// }
|
||||
// c : 1
|
||||
// }
|
||||
//
|
||||
// And an update message:
|
||||
//
|
||||
// f {
|
||||
// b {
|
||||
// d : 10
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// then if the field mask is:
|
||||
//
|
||||
// paths: "f.b"
|
||||
//
|
||||
// then the result will be:
|
||||
//
|
||||
// f {
|
||||
// b {
|
||||
// d : 10
|
||||
// }
|
||||
// c : 1
|
||||
// }
|
||||
//
|
||||
// However, if the update mask was:
|
||||
//
|
||||
// paths: "f.b.d"
|
||||
//
|
||||
// then the result would be:
|
||||
//
|
||||
// f {
|
||||
// b {
|
||||
// d : 10
|
||||
// x : 2
|
||||
// }
|
||||
// c : 1
|
||||
// }
|
||||
//
|
||||
// In order to reset a field's value to the default, the field must
|
||||
// be in the mask and set to the default value in the provided resource.
|
||||
// Hence, in order to reset all fields of a resource, provide a default
|
||||
// instance of the resource and set all fields in the mask, or do
|
||||
// not provide a mask as described below.
|
||||
//
|
||||
// If a field mask is not present on update, the operation applies to
|
||||
// all fields (as if a field mask of all fields has been specified).
|
||||
// Note that in the presence of schema evolution, this may mean that
|
||||
// fields the client does not know and has therefore not filled into
|
||||
// the request will be reset to their default. If this is unwanted
|
||||
// behavior, a specific service may require a client to always specify
|
||||
// a field mask, producing an error if not.
|
||||
//
|
||||
// As with get operations, the location of the resource which
|
||||
// describes the updated values in the request message depends on the
|
||||
// operation kind. In any case, the effect of the field mask is
|
||||
// required to be honored by the API.
|
||||
//
|
||||
// ## Considerations for HTTP REST
|
||||
//
|
||||
// The HTTP kind of an update operation which uses a field mask must
|
||||
// be set to PATCH instead of PUT in order to satisfy HTTP semantics
|
||||
// (PUT must only be used for full updates).
|
||||
//
|
||||
// # JSON Encoding of Field Masks
|
||||
//
|
||||
// In JSON, a field mask is encoded as a single string where paths are
|
||||
// separated by a comma. Fields name in each path are converted
|
||||
// to/from lower-camel naming conventions.
|
||||
//
|
||||
// As an example, consider the following message declarations:
|
||||
//
|
||||
// message Profile {
|
||||
// User user = 1;
|
||||
// Photo photo = 2;
|
||||
// }
|
||||
// message User {
|
||||
// string display_name = 1;
|
||||
// string address = 2;
|
||||
// }
|
||||
//
|
||||
// In proto a field mask for `Profile` may look as such:
|
||||
//
|
||||
// mask {
|
||||
// paths: "user.display_name"
|
||||
// paths: "photo"
|
||||
// }
|
||||
//
|
||||
// In JSON, the same mask is represented as below:
|
||||
//
|
||||
// {
|
||||
// mask: "user.displayName,photo"
|
||||
// }
|
||||
//
|
||||
// # Field Masks and Oneof Fields
|
||||
//
|
||||
// Field masks treat fields in oneofs just as regular fields. Consider the
|
||||
// following message:
|
||||
//
|
||||
// message SampleMessage {
|
||||
// oneof test_oneof {
|
||||
// string name = 4;
|
||||
// SubMessage sub_message = 9;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// The field mask can be:
|
||||
//
|
||||
// mask {
|
||||
// paths: "name"
|
||||
// }
|
||||
//
|
||||
// Or:
|
||||
//
|
||||
// mask {
|
||||
// paths: "sub_message"
|
||||
// }
|
||||
//
|
||||
// Note that oneof type names ("test_oneof" in this case) cannot be used in
|
||||
// paths.
|
||||
type FieldMask struct {
|
||||
// The set of field mask paths.
|
||||
Paths []string `protobuf:"bytes,1,rep,name=paths" json:"paths,omitempty"`
|
||||
}
|
||||
|
||||
func (m *FieldMask) Reset() { *m = FieldMask{} }
|
||||
func (m *FieldMask) String() string { return proto.CompactTextString(m) }
|
||||
func (*FieldMask) ProtoMessage() {}
|
||||
func (*FieldMask) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*FieldMask)(nil), "google.protobuf.FieldMask")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/protobuf/field_mask.proto", fileDescriptor2)
|
||||
}
|
||||
|
||||
var fileDescriptor2 = []byte{
|
||||
// 163 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x32, 0x49, 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, 0x07, 0x93, 0x49, 0xa5, 0x69, 0xfa, 0x69, 0x99, 0xa9,
|
||||
0x39, 0x29, 0xf1, 0xb9, 0x89, 0xc5, 0xd9, 0x7a, 0x60, 0x31, 0x21, 0x7e, 0xa8, 0x2e, 0x98, 0x0a,
|
||||
0x25, 0x45, 0x2e, 0x4e, 0x37, 0x90, 0x22, 0x5f, 0xa0, 0x1a, 0x21, 0x11, 0x2e, 0xd6, 0x82, 0xc4,
|
||||
0x92, 0x8c, 0x62, 0x09, 0x46, 0x05, 0x66, 0x0d, 0xce, 0x20, 0x08, 0xc7, 0x29, 0x90, 0x4b, 0x38,
|
||||
0x39, 0x3f, 0x57, 0x0f, 0x4d, 0xa7, 0x13, 0x1f, 0x5c, 0x5f, 0x00, 0x48, 0x28, 0x80, 0x71, 0x01,
|
||||
0x23, 0xe3, 0x22, 0x26, 0x66, 0xf7, 0x00, 0xa7, 0x55, 0x4c, 0x72, 0xee, 0x10, 0xc5, 0x01, 0x50,
|
||||
0xc5, 0x7a, 0xe1, 0xa9, 0x39, 0x39, 0xde, 0x79, 0xf9, 0xe5, 0x79, 0x21, 0x95, 0x05, 0xa9, 0xc5,
|
||||
0x49, 0x6c, 0x60, 0x53, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x4c, 0x96, 0xee, 0xc5,
|
||||
0x00, 0x00, 0x00,
|
||||
}
|
||||
+246
@@ -0,0 +1,246 @@
|
||||
// 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 java_package = "com.google.protobuf";
|
||||
option java_outer_classname = "FieldMaskProto";
|
||||
option java_multiple_files = true;
|
||||
option objc_class_prefix = "GPB";
|
||||
option java_generate_equals_and_hash = true;
|
||||
|
||||
// `FieldMask` represents a set of symbolic field paths, for example:
|
||||
//
|
||||
// paths: "f.a"
|
||||
// paths: "f.b.d"
|
||||
//
|
||||
// Here `f` represents a field in some root message, `a` and `b`
|
||||
// fields in the message found in `f`, and `d` a field found in the
|
||||
// message in `f.b`.
|
||||
//
|
||||
// Field masks are used to specify a subset of fields that should be
|
||||
// returned by a get operation or modified by an update operation.
|
||||
// Field masks also have a custom JSON encoding (see below).
|
||||
//
|
||||
// # Field Masks in Projections
|
||||
//
|
||||
// When used in the context of a projection, a response message or
|
||||
// sub-message is filtered by the API to only contain those fields as
|
||||
// specified in the mask. For example, if the mask in the previous
|
||||
// example is applied to a response message as follows:
|
||||
//
|
||||
// f {
|
||||
// a : 22
|
||||
// b {
|
||||
// d : 1
|
||||
// x : 2
|
||||
// }
|
||||
// y : 13
|
||||
// }
|
||||
// z: 8
|
||||
//
|
||||
// The result will not contain specific values for fields x,y and z
|
||||
// (their value will be set to the default, and omitted in proto text
|
||||
// output):
|
||||
//
|
||||
//
|
||||
// f {
|
||||
// a : 22
|
||||
// b {
|
||||
// d : 1
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// A repeated field is not allowed except at the last position of a
|
||||
// field mask.
|
||||
//
|
||||
// If a FieldMask object is not present in a get operation, the
|
||||
// operation applies to all fields (as if a FieldMask of all fields
|
||||
// had been specified).
|
||||
//
|
||||
// Note that a field mask does not necessarily apply to the
|
||||
// top-level response message. In case of a REST get operation, the
|
||||
// field mask applies directly to the response, but in case of a REST
|
||||
// list operation, the mask instead applies to each individual message
|
||||
// in the returned resource list. In case of a REST custom method,
|
||||
// other definitions may be used. Where the mask applies will be
|
||||
// clearly documented together with its declaration in the API. In
|
||||
// any case, the effect on the returned resource/resources is required
|
||||
// behavior for APIs.
|
||||
//
|
||||
// # Field Masks in Update Operations
|
||||
//
|
||||
// A field mask in update operations specifies which fields of the
|
||||
// targeted resource are going to be updated. The API is required
|
||||
// to only change the values of the fields as specified in the mask
|
||||
// and leave the others untouched. If a resource is passed in to
|
||||
// describe the updated values, the API ignores the values of all
|
||||
// fields not covered by the mask.
|
||||
//
|
||||
// If a repeated field is specified for an update operation, the existing
|
||||
// repeated values in the target resource will be overwritten by the new values.
|
||||
// Note that a repeated field is only allowed in the last position of a field
|
||||
// mask.
|
||||
//
|
||||
// If a sub-message is specified in the last position of the field mask for an
|
||||
// update operation, then the existing sub-message in the target resource is
|
||||
// overwritten. Given the target message:
|
||||
//
|
||||
// f {
|
||||
// b {
|
||||
// d : 1
|
||||
// x : 2
|
||||
// }
|
||||
// c : 1
|
||||
// }
|
||||
//
|
||||
// And an update message:
|
||||
//
|
||||
// f {
|
||||
// b {
|
||||
// d : 10
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// then if the field mask is:
|
||||
//
|
||||
// paths: "f.b"
|
||||
//
|
||||
// then the result will be:
|
||||
//
|
||||
// f {
|
||||
// b {
|
||||
// d : 10
|
||||
// }
|
||||
// c : 1
|
||||
// }
|
||||
//
|
||||
// However, if the update mask was:
|
||||
//
|
||||
// paths: "f.b.d"
|
||||
//
|
||||
// then the result would be:
|
||||
//
|
||||
// f {
|
||||
// b {
|
||||
// d : 10
|
||||
// x : 2
|
||||
// }
|
||||
// c : 1
|
||||
// }
|
||||
//
|
||||
// In order to reset a field's value to the default, the field must
|
||||
// be in the mask and set to the default value in the provided resource.
|
||||
// Hence, in order to reset all fields of a resource, provide a default
|
||||
// instance of the resource and set all fields in the mask, or do
|
||||
// not provide a mask as described below.
|
||||
//
|
||||
// If a field mask is not present on update, the operation applies to
|
||||
// all fields (as if a field mask of all fields has been specified).
|
||||
// Note that in the presence of schema evolution, this may mean that
|
||||
// fields the client does not know and has therefore not filled into
|
||||
// the request will be reset to their default. If this is unwanted
|
||||
// behavior, a specific service may require a client to always specify
|
||||
// a field mask, producing an error if not.
|
||||
//
|
||||
// As with get operations, the location of the resource which
|
||||
// describes the updated values in the request message depends on the
|
||||
// operation kind. In any case, the effect of the field mask is
|
||||
// required to be honored by the API.
|
||||
//
|
||||
// ## Considerations for HTTP REST
|
||||
//
|
||||
// The HTTP kind of an update operation which uses a field mask must
|
||||
// be set to PATCH instead of PUT in order to satisfy HTTP semantics
|
||||
// (PUT must only be used for full updates).
|
||||
//
|
||||
// # JSON Encoding of Field Masks
|
||||
//
|
||||
// In JSON, a field mask is encoded as a single string where paths are
|
||||
// separated by a comma. Fields name in each path are converted
|
||||
// to/from lower-camel naming conventions.
|
||||
//
|
||||
// As an example, consider the following message declarations:
|
||||
//
|
||||
// message Profile {
|
||||
// User user = 1;
|
||||
// Photo photo = 2;
|
||||
// }
|
||||
// message User {
|
||||
// string display_name = 1;
|
||||
// string address = 2;
|
||||
// }
|
||||
//
|
||||
// In proto a field mask for `Profile` may look as such:
|
||||
//
|
||||
// mask {
|
||||
// paths: "user.display_name"
|
||||
// paths: "photo"
|
||||
// }
|
||||
//
|
||||
// In JSON, the same mask is represented as below:
|
||||
//
|
||||
// {
|
||||
// mask: "user.displayName,photo"
|
||||
// }
|
||||
//
|
||||
// # Field Masks and Oneof Fields
|
||||
//
|
||||
// Field masks treat fields in oneofs just as regular fields. Consider the
|
||||
// following message:
|
||||
//
|
||||
// message SampleMessage {
|
||||
// oneof test_oneof {
|
||||
// string name = 4;
|
||||
// SubMessage sub_message = 9;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// The field mask can be:
|
||||
//
|
||||
// mask {
|
||||
// paths: "name"
|
||||
// }
|
||||
//
|
||||
// Or:
|
||||
//
|
||||
// mask {
|
||||
// paths: "sub_message"
|
||||
// }
|
||||
//
|
||||
// Note that oneof type names ("test_oneof" in this case) cannot be used in
|
||||
// paths.
|
||||
message FieldMask {
|
||||
// The set of field mask paths.
|
||||
repeated string paths = 1;
|
||||
}
|
||||
Generated
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: google.golang.org/genproto/protobuf/source_context.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package descriptor // import "google.golang.org/genproto/protobuf"
|
||||
|
||||
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
|
||||
|
||||
// `SourceContext` represents information about the source of a
|
||||
// protobuf element, like the file in which it is defined.
|
||||
type SourceContext struct {
|
||||
// The path-qualified name of the .proto file that contained the associated
|
||||
// protobuf element. For example: `"google/protobuf/source_context.proto"`.
|
||||
FileName string `protobuf:"bytes,1,opt,name=file_name,json=fileName" json:"file_name,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SourceContext) Reset() { *m = SourceContext{} }
|
||||
func (m *SourceContext) String() string { return proto.CompactTextString(m) }
|
||||
func (*SourceContext) ProtoMessage() {}
|
||||
func (*SourceContext) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*SourceContext)(nil), "google.protobuf.SourceContext")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google.golang.org/genproto/protobuf/source_context.proto", fileDescriptor3)
|
||||
}
|
||||
|
||||
var fileDescriptor3 = []byte{
|
||||
// 175 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xb2, 0x48, 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, 0x07, 0x93, 0x49, 0xa5, 0x69, 0xfa, 0xc5, 0xf9, 0xa5,
|
||||
0x45, 0xc9, 0xa9, 0xf1, 0xc9, 0xf9, 0x79, 0x25, 0xa9, 0x15, 0x25, 0x7a, 0x60, 0x71, 0x21, 0x7e,
|
||||
0xa8, 0x4e, 0x98, 0x2a, 0x25, 0x1d, 0x2e, 0xde, 0x60, 0xb0, 0x42, 0x67, 0x88, 0x3a, 0x21, 0x69,
|
||||
0x2e, 0xce, 0xb4, 0xcc, 0x9c, 0xd4, 0xf8, 0xbc, 0xc4, 0xdc, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d,
|
||||
0xce, 0x20, 0x0e, 0x90, 0x80, 0x1f, 0x90, 0xef, 0x14, 0xca, 0x25, 0x9c, 0x9c, 0x9f, 0xab, 0x87,
|
||||
0x66, 0x88, 0x93, 0x10, 0x8a, 0x11, 0x01, 0x20, 0xe1, 0x00, 0xc6, 0x05, 0x8c, 0x8c, 0x8b, 0x98,
|
||||
0x98, 0xdd, 0x03, 0x9c, 0x56, 0x31, 0xc9, 0xb9, 0x43, 0x34, 0x04, 0x40, 0x35, 0xe8, 0x85, 0xa7,
|
||||
0xe6, 0xe4, 0x78, 0xe7, 0xe5, 0x97, 0xe7, 0x85, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x4d,
|
||||
0x32, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xd3, 0x31, 0x36, 0x7e, 0xd8, 0x00, 0x00, 0x00,
|
||||
}
|
||||
Generated
Vendored
+48
@@ -0,0 +1,48 @@
|
||||
// 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 java_package = "com.google.protobuf";
|
||||
option java_outer_classname = "SourceContextProto";
|
||||
option java_multiple_files = true;
|
||||
option java_generate_equals_and_hash = true;
|
||||
option objc_class_prefix = "GPB";
|
||||
|
||||
// `SourceContext` represents information about the source of a
|
||||
// protobuf element, like the file in which it is defined.
|
||||
message SourceContext {
|
||||
// The path-qualified name of the .proto file that contained the associated
|
||||
// protobuf element. For example: `"google/protobuf/source_context.proto"`.
|
||||
string file_name = 1;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user