mirror of
https://github.com/gomods/athens
synced 2026-02-03 11:00:32 +00:00
Add stackdriver to traces (#737)
This commit is contained in:
@@ -85,9 +85,12 @@ func App(conf *config.Config) (*buffalo.App, error) {
|
||||
// RegisterExporter returns the function that all traces are flushed to the exporter
|
||||
// and the exporter needs to be stopped. The function should be called when the exporter
|
||||
// is no longer needed.
|
||||
flushTraces, err := observ.RegisterExporter(conf.TraceExporter,
|
||||
flushTraces, err := observ.RegisterExporter(
|
||||
conf.TraceExporter,
|
||||
conf.TraceExporterURL,
|
||||
Service, ENV)
|
||||
Service,
|
||||
ENV,
|
||||
)
|
||||
if err != nil {
|
||||
lggr.Infof("%s", err)
|
||||
} else {
|
||||
|
||||
+3
-2
@@ -137,11 +137,12 @@ EnableCSRFProtection = false
|
||||
HGRCPath = ""
|
||||
|
||||
# TraceExporterURL is the URL to which Athens populates distributed tracing
|
||||
# information such as Jaeger.
|
||||
# information such as Jaeger. In Stackdriver, use this as the GCP ProjectID.
|
||||
# Env override: ATHENS_TRACE_EXPORTER_URL
|
||||
TraceExporterURL = ""
|
||||
|
||||
# TraceExporter is the service to which the data collected by OpenCensus can be exported to
|
||||
# TraceExporter is the service to which the data collected by OpenCensus can be exported to.
|
||||
# Possible values are: jaeger, datadog, and stackdriver.
|
||||
# Env overide: ATHENS_TRACE_EXPORTER
|
||||
TraceExporter = ""
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ module github.com/gomods/athens
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.26.0
|
||||
contrib.go.opencensus.io/exporter/stackdriver v0.6.0 // indirect
|
||||
contrib.go.opencensus.io/exporter/stackdriver v0.6.0
|
||||
github.com/Azure/azure-pipeline-go v0.0.0-20180607212504-7571e8eb0876 // indirect
|
||||
github.com/Azure/azure-storage-blob-go v0.0.0-20180727221336-197d1c0aea1b
|
||||
github.com/BurntSushi/toml v0.3.0
|
||||
|
||||
+23
-18
@@ -2,8 +2,10 @@ package observ
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"contrib.go.opencensus.io/exporter/stackdriver"
|
||||
datadog "github.com/DataDog/opencensus-go-exporter-datadog"
|
||||
"github.com/gobuffalo/buffalo"
|
||||
"github.com/gomods/athens/pkg/errors"
|
||||
@@ -21,33 +23,26 @@ type observabilityContext struct {
|
||||
// RegisterExporter determines the type of TraceExporter service for exporting traces from opencensus
|
||||
// User can choose from multiple tracing services (datadog, jaegar)
|
||||
// RegisterExporter returns the 'Flush' function for that particular tracing service
|
||||
// TODO: Extend beyond jaeger and datadog
|
||||
func RegisterExporter(TraceExporter, URL, service, ENV string) (func(), error) {
|
||||
func RegisterExporter(traceExporter, URL, service, ENV string) (func(), error) {
|
||||
const op errors.Op = "RegisterExporter"
|
||||
switch TraceExporter {
|
||||
switch traceExporter {
|
||||
case "jaeger":
|
||||
ex, err := registerJaegerExporter(URL, service, ENV)
|
||||
if err != nil {
|
||||
return nil, errors.E(op, err)
|
||||
}
|
||||
return ex.Flush, nil
|
||||
return registerJaegerExporter(URL, service, ENV)
|
||||
case "datadog":
|
||||
ex, err := registerDatadogExporter(URL, service, ENV)
|
||||
if err != nil {
|
||||
return nil, errors.E(op, err)
|
||||
}
|
||||
return ex.Stop, nil
|
||||
return registerDatadogExporter(URL, service, ENV)
|
||||
case "stackdriver":
|
||||
return registerStackdriverExporter(URL, ENV)
|
||||
case "":
|
||||
return nil, errors.E(op, "Exporter not specified. Traces won't be exported")
|
||||
default:
|
||||
return nil, errors.E(op, "Exporter not supported. Please open PR or an issue at github.com/gomods/athens")
|
||||
return nil, errors.E(op, fmt.Sprintf("Exporter %s not supported. Please open PR or an issue at github.com/gomods/athens", traceExporter))
|
||||
}
|
||||
}
|
||||
|
||||
// registerJaegerExporter creates a jaeger exporter for exporting traces to opencensus.
|
||||
// Currently uses the 'TraceExporter' variable in the config file.
|
||||
// It should in the future have a nice sampling rate defined
|
||||
func registerJaegerExporter(URL, service, ENV string) (*jaeger.Exporter, error) {
|
||||
func registerJaegerExporter(URL, service, ENV string) (func(), error) {
|
||||
const op errors.Op = "registerJaegarExporter"
|
||||
if URL == "" {
|
||||
return nil, errors.E(op, "Exporter URL is empty. Traces won't be exported")
|
||||
@@ -68,7 +63,7 @@ func registerJaegerExporter(URL, service, ENV string) (*jaeger.Exporter, error)
|
||||
return nil, errors.E(op, err)
|
||||
}
|
||||
traceRegisterExporter(ex, ENV)
|
||||
return ex, nil
|
||||
return ex.Flush, nil
|
||||
}
|
||||
|
||||
func traceRegisterExporter(exporter trace.Exporter, ENV string) {
|
||||
@@ -80,14 +75,24 @@ func traceRegisterExporter(exporter trace.Exporter, ENV string) {
|
||||
|
||||
// registerDatadogTracerExporter creates a datadog exporter.
|
||||
// Currently uses the 'TraceExporter' variable in the config file.
|
||||
func registerDatadogExporter(URL, service, ENV string) (*datadog.Exporter, error) {
|
||||
func registerDatadogExporter(URL, service, ENV string) (func(), error) {
|
||||
ex := datadog.NewExporter(
|
||||
datadog.Options{
|
||||
TraceAddr: URL,
|
||||
Service: service,
|
||||
})
|
||||
traceRegisterExporter(ex, ENV)
|
||||
return ex, nil
|
||||
return ex.Stop, nil
|
||||
}
|
||||
|
||||
func registerStackdriverExporter(projectID, ENV string) (func(), error) {
|
||||
const op errors.Op = "registerStackdriverExporter"
|
||||
ex, err := stackdriver.NewExporter(stackdriver.Options{ProjectID: projectID})
|
||||
if err != nil {
|
||||
return nil, errors.E(op, err)
|
||||
}
|
||||
traceRegisterExporter(ex, ENV)
|
||||
return ex.Flush, nil
|
||||
}
|
||||
|
||||
// Tracer is a middleware that starts a span from the top of a buffalo context
|
||||
|
||||
+279
@@ -0,0 +1,279 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://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 monitoring
|
||||
|
||||
import (
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"cloud.google.com/go/internal/version"
|
||||
"github.com/golang/protobuf/proto"
|
||||
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"
|
||||
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
// AlertPolicyCallOptions contains the retry settings for each method of AlertPolicyClient.
|
||||
type AlertPolicyCallOptions struct {
|
||||
ListAlertPolicies []gax.CallOption
|
||||
GetAlertPolicy []gax.CallOption
|
||||
CreateAlertPolicy []gax.CallOption
|
||||
DeleteAlertPolicy []gax.CallOption
|
||||
UpdateAlertPolicy []gax.CallOption
|
||||
}
|
||||
|
||||
func defaultAlertPolicyClientOptions() []option.ClientOption {
|
||||
return []option.ClientOption{
|
||||
option.WithEndpoint("monitoring.googleapis.com:443"),
|
||||
option.WithScopes(DefaultAuthScopes()...),
|
||||
}
|
||||
}
|
||||
|
||||
func defaultAlertPolicyCallOptions() *AlertPolicyCallOptions {
|
||||
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: 60000 * time.Millisecond,
|
||||
Multiplier: 1.3,
|
||||
})
|
||||
}),
|
||||
},
|
||||
}
|
||||
return &AlertPolicyCallOptions{
|
||||
ListAlertPolicies: retry[[2]string{"default", "idempotent"}],
|
||||
GetAlertPolicy: retry[[2]string{"default", "idempotent"}],
|
||||
CreateAlertPolicy: retry[[2]string{"default", "non_idempotent"}],
|
||||
DeleteAlertPolicy: retry[[2]string{"default", "idempotent"}],
|
||||
UpdateAlertPolicy: retry[[2]string{"default", "non_idempotent"}],
|
||||
}
|
||||
}
|
||||
|
||||
// AlertPolicyClient is a client for interacting with Stackdriver Monitoring API.
|
||||
//
|
||||
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
|
||||
type AlertPolicyClient struct {
|
||||
// The connection to the service.
|
||||
conn *grpc.ClientConn
|
||||
|
||||
// The gRPC API client.
|
||||
alertPolicyClient monitoringpb.AlertPolicyServiceClient
|
||||
|
||||
// The call options for this service.
|
||||
CallOptions *AlertPolicyCallOptions
|
||||
|
||||
// The x-goog-* metadata to be sent with each request.
|
||||
xGoogMetadata metadata.MD
|
||||
}
|
||||
|
||||
// NewAlertPolicyClient creates a new alert policy service client.
|
||||
//
|
||||
// The AlertPolicyService API is used to manage (list, create, delete,
|
||||
// edit) alert policies in Stackdriver Monitoring. An alerting policy is
|
||||
// a description of the conditions under which some aspect of your
|
||||
// system is considered to be "unhealthy" and the ways to notify
|
||||
// people or services about this state. In addition to using this API, alert
|
||||
// policies can also be managed through
|
||||
// Stackdriver Monitoring (at https://cloud.google.com/monitoring/docs/),
|
||||
// which can be reached by clicking the "Monitoring" tab in
|
||||
// Cloud Console (at https://console.cloud.google.com/).
|
||||
func NewAlertPolicyClient(ctx context.Context, opts ...option.ClientOption) (*AlertPolicyClient, error) {
|
||||
conn, err := transport.DialGRPC(ctx, append(defaultAlertPolicyClientOptions(), opts...)...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c := &AlertPolicyClient{
|
||||
conn: conn,
|
||||
CallOptions: defaultAlertPolicyCallOptions(),
|
||||
|
||||
alertPolicyClient: monitoringpb.NewAlertPolicyServiceClient(conn),
|
||||
}
|
||||
c.setGoogleClientInfo()
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// Connection returns the client's connection to the API service.
|
||||
func (c *AlertPolicyClient) 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 *AlertPolicyClient) 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 *AlertPolicyClient) setGoogleClientInfo(keyval ...string) {
|
||||
kv := append([]string{"gl-go", version.Go()}, keyval...)
|
||||
kv = append(kv, "gapic", version.Repo, "gax", gax.Version, "grpc", grpc.Version)
|
||||
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
||||
// ListAlertPolicies lists the existing alerting policies for the project.
|
||||
func (c *AlertPolicyClient) ListAlertPolicies(ctx context.Context, req *monitoringpb.ListAlertPoliciesRequest, opts ...gax.CallOption) *AlertPolicyIterator {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListAlertPolicies[0:len(c.CallOptions.ListAlertPolicies):len(c.CallOptions.ListAlertPolicies)], opts...)
|
||||
it := &AlertPolicyIterator{}
|
||||
req = proto.Clone(req).(*monitoringpb.ListAlertPoliciesRequest)
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoringpb.AlertPolicy, string, error) {
|
||||
var resp *monitoringpb.ListAlertPoliciesResponse
|
||||
req.PageToken = pageToken
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.alertPolicyClient.ListAlertPolicies(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return resp.AlertPolicies, 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)
|
||||
it.pageInfo.MaxSize = int(req.PageSize)
|
||||
return it
|
||||
}
|
||||
|
||||
// GetAlertPolicy gets a single alerting policy.
|
||||
func (c *AlertPolicyClient) GetAlertPolicy(ctx context.Context, req *monitoringpb.GetAlertPolicyRequest, opts ...gax.CallOption) (*monitoringpb.AlertPolicy, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.GetAlertPolicy[0:len(c.CallOptions.GetAlertPolicy):len(c.CallOptions.GetAlertPolicy)], opts...)
|
||||
var resp *monitoringpb.AlertPolicy
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.alertPolicyClient.GetAlertPolicy(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// CreateAlertPolicy creates a new alerting policy.
|
||||
func (c *AlertPolicyClient) CreateAlertPolicy(ctx context.Context, req *monitoringpb.CreateAlertPolicyRequest, opts ...gax.CallOption) (*monitoringpb.AlertPolicy, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.CreateAlertPolicy[0:len(c.CallOptions.CreateAlertPolicy):len(c.CallOptions.CreateAlertPolicy)], opts...)
|
||||
var resp *monitoringpb.AlertPolicy
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.alertPolicyClient.CreateAlertPolicy(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// DeleteAlertPolicy deletes an alerting policy.
|
||||
func (c *AlertPolicyClient) DeleteAlertPolicy(ctx context.Context, req *monitoringpb.DeleteAlertPolicyRequest, opts ...gax.CallOption) error {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.DeleteAlertPolicy[0:len(c.CallOptions.DeleteAlertPolicy):len(c.CallOptions.DeleteAlertPolicy)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
_, err = c.alertPolicyClient.DeleteAlertPolicy(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdateAlertPolicy updates an alerting policy. You can either replace the entire policy with
|
||||
// a new one or replace only certain fields in the current alerting policy by
|
||||
// specifying the fields to be updated via updateMask. Returns the
|
||||
// updated alerting policy.
|
||||
func (c *AlertPolicyClient) UpdateAlertPolicy(ctx context.Context, req *monitoringpb.UpdateAlertPolicyRequest, opts ...gax.CallOption) (*monitoringpb.AlertPolicy, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.UpdateAlertPolicy[0:len(c.CallOptions.UpdateAlertPolicy):len(c.CallOptions.UpdateAlertPolicy)], opts...)
|
||||
var resp *monitoringpb.AlertPolicy
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.alertPolicyClient.UpdateAlertPolicy(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// AlertPolicyIterator manages a stream of *monitoringpb.AlertPolicy.
|
||||
type AlertPolicyIterator struct {
|
||||
items []*monitoringpb.AlertPolicy
|
||||
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 []*monitoringpb.AlertPolicy, nextPageToken string, err error)
|
||||
}
|
||||
|
||||
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
|
||||
func (it *AlertPolicyIterator) 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 *AlertPolicyIterator) Next() (*monitoringpb.AlertPolicy, error) {
|
||||
var item *monitoringpb.AlertPolicy
|
||||
if err := it.nextFunc(); err != nil {
|
||||
return item, err
|
||||
}
|
||||
item = it.items[0]
|
||||
it.items = it.items[1:]
|
||||
return item, nil
|
||||
}
|
||||
|
||||
func (it *AlertPolicyIterator) bufLen() int {
|
||||
return len(it.items)
|
||||
}
|
||||
|
||||
func (it *AlertPolicyIterator) takeBuf() interface{} {
|
||||
b := it.items
|
||||
it.items = nil
|
||||
return b
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://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 monitoring is an auto-generated package for the
|
||||
// Stackdriver Monitoring API.
|
||||
//
|
||||
// NOTE: This package is in alpha. It is not stable, and is likely to change.
|
||||
//
|
||||
// Manages your Stackdriver Monitoring data and configurations. Most projects
|
||||
// must be associated with a Stackdriver account, with a few exceptions as
|
||||
// noted on the individual method pages.
|
||||
package monitoring // import "cloud.google.com/go/monitoring/apiv3"
|
||||
|
||||
import (
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
|
||||
out, _ := metadata.FromOutgoingContext(ctx)
|
||||
out = out.Copy()
|
||||
for _, md := range mds {
|
||||
for k, v := range md {
|
||||
out[k] = append(out[k], v...)
|
||||
}
|
||||
}
|
||||
return metadata.NewOutgoingContext(ctx, out)
|
||||
}
|
||||
|
||||
// DefaultAuthScopes reports the default set of authentication scopes to use with this package.
|
||||
func DefaultAuthScopes() []string {
|
||||
return []string{
|
||||
"https://www.googleapis.com/auth/cloud-platform",
|
||||
"https://www.googleapis.com/auth/monitoring",
|
||||
"https://www.googleapis.com/auth/monitoring.read",
|
||||
"https://www.googleapis.com/auth/monitoring.write",
|
||||
}
|
||||
}
|
||||
+362
@@ -0,0 +1,362 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://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 monitoring
|
||||
|
||||
import (
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"cloud.google.com/go/internal/version"
|
||||
"github.com/golang/protobuf/proto"
|
||||
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"
|
||||
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
// GroupCallOptions contains the retry settings for each method of GroupClient.
|
||||
type GroupCallOptions struct {
|
||||
ListGroups []gax.CallOption
|
||||
GetGroup []gax.CallOption
|
||||
CreateGroup []gax.CallOption
|
||||
UpdateGroup []gax.CallOption
|
||||
DeleteGroup []gax.CallOption
|
||||
ListGroupMembers []gax.CallOption
|
||||
}
|
||||
|
||||
func defaultGroupClientOptions() []option.ClientOption {
|
||||
return []option.ClientOption{
|
||||
option.WithEndpoint("monitoring.googleapis.com:443"),
|
||||
option.WithScopes(DefaultAuthScopes()...),
|
||||
}
|
||||
}
|
||||
|
||||
func defaultGroupCallOptions() *GroupCallOptions {
|
||||
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: 60000 * time.Millisecond,
|
||||
Multiplier: 1.3,
|
||||
})
|
||||
}),
|
||||
},
|
||||
}
|
||||
return &GroupCallOptions{
|
||||
ListGroups: retry[[2]string{"default", "idempotent"}],
|
||||
GetGroup: retry[[2]string{"default", "idempotent"}],
|
||||
CreateGroup: retry[[2]string{"default", "non_idempotent"}],
|
||||
UpdateGroup: retry[[2]string{"default", "idempotent"}],
|
||||
DeleteGroup: retry[[2]string{"default", "idempotent"}],
|
||||
ListGroupMembers: retry[[2]string{"default", "idempotent"}],
|
||||
}
|
||||
}
|
||||
|
||||
// GroupClient is a client for interacting with Stackdriver Monitoring API.
|
||||
//
|
||||
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
|
||||
type GroupClient struct {
|
||||
// The connection to the service.
|
||||
conn *grpc.ClientConn
|
||||
|
||||
// The gRPC API client.
|
||||
groupClient monitoringpb.GroupServiceClient
|
||||
|
||||
// The call options for this service.
|
||||
CallOptions *GroupCallOptions
|
||||
|
||||
// The x-goog-* metadata to be sent with each request.
|
||||
xGoogMetadata metadata.MD
|
||||
}
|
||||
|
||||
// NewGroupClient creates a new group service client.
|
||||
//
|
||||
// The Group API lets you inspect and manage your
|
||||
// groups (at #google.monitoring.v3.Group).
|
||||
//
|
||||
// A group is a named filter that is used to identify
|
||||
// a collection of monitored resources. Groups are typically used to
|
||||
// mirror the physical and/or logical topology of the environment.
|
||||
// Because group membership is computed dynamically, monitored
|
||||
// resources that are started in the future are automatically placed
|
||||
// in matching groups. By using a group to name monitored resources in,
|
||||
// for example, an alert policy, the target of that alert policy is
|
||||
// updated automatically as monitored resources are added and removed
|
||||
// from the infrastructure.
|
||||
func NewGroupClient(ctx context.Context, opts ...option.ClientOption) (*GroupClient, error) {
|
||||
conn, err := transport.DialGRPC(ctx, append(defaultGroupClientOptions(), opts...)...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c := &GroupClient{
|
||||
conn: conn,
|
||||
CallOptions: defaultGroupCallOptions(),
|
||||
|
||||
groupClient: monitoringpb.NewGroupServiceClient(conn),
|
||||
}
|
||||
c.setGoogleClientInfo()
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// Connection returns the client's connection to the API service.
|
||||
func (c *GroupClient) 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 *GroupClient) 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 *GroupClient) setGoogleClientInfo(keyval ...string) {
|
||||
kv := append([]string{"gl-go", version.Go()}, keyval...)
|
||||
kv = append(kv, "gapic", version.Repo, "gax", gax.Version, "grpc", grpc.Version)
|
||||
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
||||
// ListGroups lists the existing groups.
|
||||
func (c *GroupClient) ListGroups(ctx context.Context, req *monitoringpb.ListGroupsRequest, opts ...gax.CallOption) *GroupIterator {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListGroups[0:len(c.CallOptions.ListGroups):len(c.CallOptions.ListGroups)], opts...)
|
||||
it := &GroupIterator{}
|
||||
req = proto.Clone(req).(*monitoringpb.ListGroupsRequest)
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoringpb.Group, string, error) {
|
||||
var resp *monitoringpb.ListGroupsResponse
|
||||
req.PageToken = pageToken
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.groupClient.ListGroups(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return resp.Group, 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)
|
||||
it.pageInfo.MaxSize = int(req.PageSize)
|
||||
return it
|
||||
}
|
||||
|
||||
// GetGroup gets a single group.
|
||||
func (c *GroupClient) GetGroup(ctx context.Context, req *monitoringpb.GetGroupRequest, opts ...gax.CallOption) (*monitoringpb.Group, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.GetGroup[0:len(c.CallOptions.GetGroup):len(c.CallOptions.GetGroup)], opts...)
|
||||
var resp *monitoringpb.Group
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.groupClient.GetGroup(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// CreateGroup creates a new group.
|
||||
func (c *GroupClient) CreateGroup(ctx context.Context, req *monitoringpb.CreateGroupRequest, opts ...gax.CallOption) (*monitoringpb.Group, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.CreateGroup[0:len(c.CallOptions.CreateGroup):len(c.CallOptions.CreateGroup)], opts...)
|
||||
var resp *monitoringpb.Group
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.groupClient.CreateGroup(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// UpdateGroup updates an existing group.
|
||||
// You can change any group attributes except name.
|
||||
func (c *GroupClient) UpdateGroup(ctx context.Context, req *monitoringpb.UpdateGroupRequest, opts ...gax.CallOption) (*monitoringpb.Group, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.UpdateGroup[0:len(c.CallOptions.UpdateGroup):len(c.CallOptions.UpdateGroup)], opts...)
|
||||
var resp *monitoringpb.Group
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.groupClient.UpdateGroup(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// DeleteGroup deletes an existing group.
|
||||
func (c *GroupClient) DeleteGroup(ctx context.Context, req *monitoringpb.DeleteGroupRequest, opts ...gax.CallOption) error {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.DeleteGroup[0:len(c.CallOptions.DeleteGroup):len(c.CallOptions.DeleteGroup)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
_, err = c.groupClient.DeleteGroup(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
return err
|
||||
}
|
||||
|
||||
// ListGroupMembers lists the monitored resources that are members of a group.
|
||||
func (c *GroupClient) ListGroupMembers(ctx context.Context, req *monitoringpb.ListGroupMembersRequest, opts ...gax.CallOption) *MonitoredResourceIterator {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListGroupMembers[0:len(c.CallOptions.ListGroupMembers):len(c.CallOptions.ListGroupMembers)], opts...)
|
||||
it := &MonitoredResourceIterator{}
|
||||
req = proto.Clone(req).(*monitoringpb.ListGroupMembersRequest)
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoredrespb.MonitoredResource, string, error) {
|
||||
var resp *monitoringpb.ListGroupMembersResponse
|
||||
req.PageToken = pageToken
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.groupClient.ListGroupMembers(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return resp.Members, 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)
|
||||
it.pageInfo.MaxSize = int(req.PageSize)
|
||||
return it
|
||||
}
|
||||
|
||||
// GroupIterator manages a stream of *monitoringpb.Group.
|
||||
type GroupIterator struct {
|
||||
items []*monitoringpb.Group
|
||||
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 []*monitoringpb.Group, nextPageToken string, err error)
|
||||
}
|
||||
|
||||
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
|
||||
func (it *GroupIterator) 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 *GroupIterator) Next() (*monitoringpb.Group, error) {
|
||||
var item *monitoringpb.Group
|
||||
if err := it.nextFunc(); err != nil {
|
||||
return item, err
|
||||
}
|
||||
item = it.items[0]
|
||||
it.items = it.items[1:]
|
||||
return item, nil
|
||||
}
|
||||
|
||||
func (it *GroupIterator) bufLen() int {
|
||||
return len(it.items)
|
||||
}
|
||||
|
||||
func (it *GroupIterator) takeBuf() interface{} {
|
||||
b := it.items
|
||||
it.items = nil
|
||||
return b
|
||||
}
|
||||
|
||||
// MonitoredResourceIterator manages a stream of *monitoredrespb.MonitoredResource.
|
||||
type MonitoredResourceIterator struct {
|
||||
items []*monitoredrespb.MonitoredResource
|
||||
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.MonitoredResource, nextPageToken string, err error)
|
||||
}
|
||||
|
||||
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
|
||||
func (it *MonitoredResourceIterator) 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 *MonitoredResourceIterator) Next() (*monitoredrespb.MonitoredResource, error) {
|
||||
var item *monitoredrespb.MonitoredResource
|
||||
if err := it.nextFunc(); err != nil {
|
||||
return item, err
|
||||
}
|
||||
item = it.items[0]
|
||||
it.items = it.items[1:]
|
||||
return item, nil
|
||||
}
|
||||
|
||||
func (it *MonitoredResourceIterator) bufLen() int {
|
||||
return len(it.items)
|
||||
}
|
||||
|
||||
func (it *MonitoredResourceIterator) takeBuf() interface{} {
|
||||
b := it.items
|
||||
it.items = nil
|
||||
return b
|
||||
}
|
||||
+453
@@ -0,0 +1,453 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://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 monitoring
|
||||
|
||||
import (
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"cloud.google.com/go/internal/version"
|
||||
"github.com/golang/protobuf/proto"
|
||||
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"
|
||||
metricpb "google.golang.org/genproto/googleapis/api/metric"
|
||||
monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
// MetricCallOptions contains the retry settings for each method of MetricClient.
|
||||
type MetricCallOptions struct {
|
||||
ListMonitoredResourceDescriptors []gax.CallOption
|
||||
GetMonitoredResourceDescriptor []gax.CallOption
|
||||
ListMetricDescriptors []gax.CallOption
|
||||
GetMetricDescriptor []gax.CallOption
|
||||
CreateMetricDescriptor []gax.CallOption
|
||||
DeleteMetricDescriptor []gax.CallOption
|
||||
ListTimeSeries []gax.CallOption
|
||||
CreateTimeSeries []gax.CallOption
|
||||
}
|
||||
|
||||
func defaultMetricClientOptions() []option.ClientOption {
|
||||
return []option.ClientOption{
|
||||
option.WithEndpoint("monitoring.googleapis.com:443"),
|
||||
option.WithScopes(DefaultAuthScopes()...),
|
||||
}
|
||||
}
|
||||
|
||||
func defaultMetricCallOptions() *MetricCallOptions {
|
||||
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: 60000 * time.Millisecond,
|
||||
Multiplier: 1.3,
|
||||
})
|
||||
}),
|
||||
},
|
||||
}
|
||||
return &MetricCallOptions{
|
||||
ListMonitoredResourceDescriptors: retry[[2]string{"default", "idempotent"}],
|
||||
GetMonitoredResourceDescriptor: retry[[2]string{"default", "idempotent"}],
|
||||
ListMetricDescriptors: retry[[2]string{"default", "idempotent"}],
|
||||
GetMetricDescriptor: retry[[2]string{"default", "idempotent"}],
|
||||
CreateMetricDescriptor: retry[[2]string{"default", "non_idempotent"}],
|
||||
DeleteMetricDescriptor: retry[[2]string{"default", "idempotent"}],
|
||||
ListTimeSeries: retry[[2]string{"default", "idempotent"}],
|
||||
CreateTimeSeries: retry[[2]string{"default", "non_idempotent"}],
|
||||
}
|
||||
}
|
||||
|
||||
// MetricClient is a client for interacting with Stackdriver Monitoring API.
|
||||
//
|
||||
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
|
||||
type MetricClient struct {
|
||||
// The connection to the service.
|
||||
conn *grpc.ClientConn
|
||||
|
||||
// The gRPC API client.
|
||||
metricClient monitoringpb.MetricServiceClient
|
||||
|
||||
// The call options for this service.
|
||||
CallOptions *MetricCallOptions
|
||||
|
||||
// The x-goog-* metadata to be sent with each request.
|
||||
xGoogMetadata metadata.MD
|
||||
}
|
||||
|
||||
// NewMetricClient creates a new metric service client.
|
||||
//
|
||||
// Manages metric descriptors, monitored resource descriptors, and
|
||||
// time series data.
|
||||
func NewMetricClient(ctx context.Context, opts ...option.ClientOption) (*MetricClient, error) {
|
||||
conn, err := transport.DialGRPC(ctx, append(defaultMetricClientOptions(), opts...)...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c := &MetricClient{
|
||||
conn: conn,
|
||||
CallOptions: defaultMetricCallOptions(),
|
||||
|
||||
metricClient: monitoringpb.NewMetricServiceClient(conn),
|
||||
}
|
||||
c.setGoogleClientInfo()
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// Connection returns the client's connection to the API service.
|
||||
func (c *MetricClient) 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 *MetricClient) 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 *MetricClient) setGoogleClientInfo(keyval ...string) {
|
||||
kv := append([]string{"gl-go", version.Go()}, keyval...)
|
||||
kv = append(kv, "gapic", version.Repo, "gax", gax.Version, "grpc", grpc.Version)
|
||||
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
||||
// ListMonitoredResourceDescriptors lists monitored resource descriptors that match a filter. This method does not require a Stackdriver account.
|
||||
func (c *MetricClient) ListMonitoredResourceDescriptors(ctx context.Context, req *monitoringpb.ListMonitoredResourceDescriptorsRequest, opts ...gax.CallOption) *MonitoredResourceDescriptorIterator {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListMonitoredResourceDescriptors[0:len(c.CallOptions.ListMonitoredResourceDescriptors):len(c.CallOptions.ListMonitoredResourceDescriptors)], opts...)
|
||||
it := &MonitoredResourceDescriptorIterator{}
|
||||
req = proto.Clone(req).(*monitoringpb.ListMonitoredResourceDescriptorsRequest)
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoredrespb.MonitoredResourceDescriptor, string, error) {
|
||||
var resp *monitoringpb.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, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.metricClient.ListMonitoredResourceDescriptors(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
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)
|
||||
it.pageInfo.MaxSize = int(req.PageSize)
|
||||
return it
|
||||
}
|
||||
|
||||
// GetMonitoredResourceDescriptor gets a single monitored resource descriptor. This method does not require a Stackdriver account.
|
||||
func (c *MetricClient) GetMonitoredResourceDescriptor(ctx context.Context, req *monitoringpb.GetMonitoredResourceDescriptorRequest, opts ...gax.CallOption) (*monitoredrespb.MonitoredResourceDescriptor, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.GetMonitoredResourceDescriptor[0:len(c.CallOptions.GetMonitoredResourceDescriptor):len(c.CallOptions.GetMonitoredResourceDescriptor)], opts...)
|
||||
var resp *monitoredrespb.MonitoredResourceDescriptor
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.metricClient.GetMonitoredResourceDescriptor(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// ListMetricDescriptors lists metric descriptors that match a filter. This method does not require a Stackdriver account.
|
||||
func (c *MetricClient) ListMetricDescriptors(ctx context.Context, req *monitoringpb.ListMetricDescriptorsRequest, opts ...gax.CallOption) *MetricDescriptorIterator {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListMetricDescriptors[0:len(c.CallOptions.ListMetricDescriptors):len(c.CallOptions.ListMetricDescriptors)], opts...)
|
||||
it := &MetricDescriptorIterator{}
|
||||
req = proto.Clone(req).(*monitoringpb.ListMetricDescriptorsRequest)
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*metricpb.MetricDescriptor, string, error) {
|
||||
var resp *monitoringpb.ListMetricDescriptorsResponse
|
||||
req.PageToken = pageToken
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.metricClient.ListMetricDescriptors(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return resp.MetricDescriptors, 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)
|
||||
it.pageInfo.MaxSize = int(req.PageSize)
|
||||
return it
|
||||
}
|
||||
|
||||
// GetMetricDescriptor gets a single metric descriptor. This method does not require a Stackdriver account.
|
||||
func (c *MetricClient) GetMetricDescriptor(ctx context.Context, req *monitoringpb.GetMetricDescriptorRequest, opts ...gax.CallOption) (*metricpb.MetricDescriptor, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.GetMetricDescriptor[0:len(c.CallOptions.GetMetricDescriptor):len(c.CallOptions.GetMetricDescriptor)], opts...)
|
||||
var resp *metricpb.MetricDescriptor
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.metricClient.GetMetricDescriptor(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// CreateMetricDescriptor creates a new metric descriptor.
|
||||
// User-created metric descriptors define
|
||||
// custom metrics (at /monitoring/custom-metrics).
|
||||
func (c *MetricClient) CreateMetricDescriptor(ctx context.Context, req *monitoringpb.CreateMetricDescriptorRequest, opts ...gax.CallOption) (*metricpb.MetricDescriptor, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.CreateMetricDescriptor[0:len(c.CallOptions.CreateMetricDescriptor):len(c.CallOptions.CreateMetricDescriptor)], opts...)
|
||||
var resp *metricpb.MetricDescriptor
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.metricClient.CreateMetricDescriptor(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// DeleteMetricDescriptor deletes a metric descriptor. Only user-created
|
||||
// custom metrics (at /monitoring/custom-metrics) can be deleted.
|
||||
func (c *MetricClient) DeleteMetricDescriptor(ctx context.Context, req *monitoringpb.DeleteMetricDescriptorRequest, opts ...gax.CallOption) error {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.DeleteMetricDescriptor[0:len(c.CallOptions.DeleteMetricDescriptor):len(c.CallOptions.DeleteMetricDescriptor)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
_, err = c.metricClient.DeleteMetricDescriptor(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
return err
|
||||
}
|
||||
|
||||
// ListTimeSeries lists time series that match a filter. This method does not require a Stackdriver account.
|
||||
func (c *MetricClient) ListTimeSeries(ctx context.Context, req *monitoringpb.ListTimeSeriesRequest, opts ...gax.CallOption) *TimeSeriesIterator {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListTimeSeries[0:len(c.CallOptions.ListTimeSeries):len(c.CallOptions.ListTimeSeries)], opts...)
|
||||
it := &TimeSeriesIterator{}
|
||||
req = proto.Clone(req).(*monitoringpb.ListTimeSeriesRequest)
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoringpb.TimeSeries, string, error) {
|
||||
var resp *monitoringpb.ListTimeSeriesResponse
|
||||
req.PageToken = pageToken
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.metricClient.ListTimeSeries(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return resp.TimeSeries, 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)
|
||||
it.pageInfo.MaxSize = int(req.PageSize)
|
||||
return it
|
||||
}
|
||||
|
||||
// CreateTimeSeries creates or adds data to one or more time series.
|
||||
// The response is empty if all time series in the request were written.
|
||||
// If any time series could not be written, a corresponding failure message is
|
||||
// included in the error response.
|
||||
func (c *MetricClient) CreateTimeSeries(ctx context.Context, req *monitoringpb.CreateTimeSeriesRequest, opts ...gax.CallOption) error {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.CreateTimeSeries[0:len(c.CallOptions.CreateTimeSeries):len(c.CallOptions.CreateTimeSeries)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
_, err = c.metricClient.CreateTimeSeries(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
return err
|
||||
}
|
||||
|
||||
// MetricDescriptorIterator manages a stream of *metricpb.MetricDescriptor.
|
||||
type MetricDescriptorIterator struct {
|
||||
items []*metricpb.MetricDescriptor
|
||||
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 []*metricpb.MetricDescriptor, nextPageToken string, err error)
|
||||
}
|
||||
|
||||
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
|
||||
func (it *MetricDescriptorIterator) 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 *MetricDescriptorIterator) Next() (*metricpb.MetricDescriptor, error) {
|
||||
var item *metricpb.MetricDescriptor
|
||||
if err := it.nextFunc(); err != nil {
|
||||
return item, err
|
||||
}
|
||||
item = it.items[0]
|
||||
it.items = it.items[1:]
|
||||
return item, nil
|
||||
}
|
||||
|
||||
func (it *MetricDescriptorIterator) bufLen() int {
|
||||
return len(it.items)
|
||||
}
|
||||
|
||||
func (it *MetricDescriptorIterator) 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
|
||||
}
|
||||
|
||||
// TimeSeriesIterator manages a stream of *monitoringpb.TimeSeries.
|
||||
type TimeSeriesIterator struct {
|
||||
items []*monitoringpb.TimeSeries
|
||||
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 []*monitoringpb.TimeSeries, nextPageToken string, err error)
|
||||
}
|
||||
|
||||
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
|
||||
func (it *TimeSeriesIterator) 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 *TimeSeriesIterator) Next() (*monitoringpb.TimeSeries, error) {
|
||||
var item *monitoringpb.TimeSeries
|
||||
if err := it.nextFunc(); err != nil {
|
||||
return item, err
|
||||
}
|
||||
item = it.items[0]
|
||||
it.items = it.items[1:]
|
||||
return item, nil
|
||||
}
|
||||
|
||||
func (it *TimeSeriesIterator) bufLen() int {
|
||||
return len(it.items)
|
||||
}
|
||||
|
||||
func (it *TimeSeriesIterator) takeBuf() interface{} {
|
||||
b := it.items
|
||||
it.items = nil
|
||||
return b
|
||||
}
|
||||
+376
@@ -0,0 +1,376 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://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 monitoring
|
||||
|
||||
import (
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"cloud.google.com/go/internal/version"
|
||||
"github.com/golang/protobuf/proto"
|
||||
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"
|
||||
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
// NotificationChannelCallOptions contains the retry settings for each method of NotificationChannelClient.
|
||||
type NotificationChannelCallOptions struct {
|
||||
ListNotificationChannelDescriptors []gax.CallOption
|
||||
GetNotificationChannelDescriptor []gax.CallOption
|
||||
ListNotificationChannels []gax.CallOption
|
||||
GetNotificationChannel []gax.CallOption
|
||||
CreateNotificationChannel []gax.CallOption
|
||||
UpdateNotificationChannel []gax.CallOption
|
||||
DeleteNotificationChannel []gax.CallOption
|
||||
}
|
||||
|
||||
func defaultNotificationChannelClientOptions() []option.ClientOption {
|
||||
return []option.ClientOption{
|
||||
option.WithEndpoint("monitoring.googleapis.com:443"),
|
||||
option.WithScopes(DefaultAuthScopes()...),
|
||||
}
|
||||
}
|
||||
|
||||
func defaultNotificationChannelCallOptions() *NotificationChannelCallOptions {
|
||||
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: 60000 * time.Millisecond,
|
||||
Multiplier: 1.3,
|
||||
})
|
||||
}),
|
||||
},
|
||||
}
|
||||
return &NotificationChannelCallOptions{
|
||||
ListNotificationChannelDescriptors: retry[[2]string{"default", "idempotent"}],
|
||||
GetNotificationChannelDescriptor: retry[[2]string{"default", "idempotent"}],
|
||||
ListNotificationChannels: retry[[2]string{"default", "idempotent"}],
|
||||
GetNotificationChannel: retry[[2]string{"default", "idempotent"}],
|
||||
CreateNotificationChannel: retry[[2]string{"default", "non_idempotent"}],
|
||||
UpdateNotificationChannel: retry[[2]string{"default", "non_idempotent"}],
|
||||
DeleteNotificationChannel: retry[[2]string{"default", "idempotent"}],
|
||||
}
|
||||
}
|
||||
|
||||
// NotificationChannelClient is a client for interacting with Stackdriver Monitoring API.
|
||||
//
|
||||
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
|
||||
type NotificationChannelClient struct {
|
||||
// The connection to the service.
|
||||
conn *grpc.ClientConn
|
||||
|
||||
// The gRPC API client.
|
||||
notificationChannelClient monitoringpb.NotificationChannelServiceClient
|
||||
|
||||
// The call options for this service.
|
||||
CallOptions *NotificationChannelCallOptions
|
||||
|
||||
// The x-goog-* metadata to be sent with each request.
|
||||
xGoogMetadata metadata.MD
|
||||
}
|
||||
|
||||
// NewNotificationChannelClient creates a new notification channel service client.
|
||||
//
|
||||
// The Notification Channel API provides access to configuration that
|
||||
// controls how messages related to incidents are sent.
|
||||
func NewNotificationChannelClient(ctx context.Context, opts ...option.ClientOption) (*NotificationChannelClient, error) {
|
||||
conn, err := transport.DialGRPC(ctx, append(defaultNotificationChannelClientOptions(), opts...)...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c := &NotificationChannelClient{
|
||||
conn: conn,
|
||||
CallOptions: defaultNotificationChannelCallOptions(),
|
||||
|
||||
notificationChannelClient: monitoringpb.NewNotificationChannelServiceClient(conn),
|
||||
}
|
||||
c.setGoogleClientInfo()
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// Connection returns the client's connection to the API service.
|
||||
func (c *NotificationChannelClient) 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 *NotificationChannelClient) 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 *NotificationChannelClient) setGoogleClientInfo(keyval ...string) {
|
||||
kv := append([]string{"gl-go", version.Go()}, keyval...)
|
||||
kv = append(kv, "gapic", version.Repo, "gax", gax.Version, "grpc", grpc.Version)
|
||||
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
||||
// ListNotificationChannelDescriptors lists the descriptors for supported channel types. The use of descriptors
|
||||
// makes it possible for new channel types to be dynamically added.
|
||||
func (c *NotificationChannelClient) ListNotificationChannelDescriptors(ctx context.Context, req *monitoringpb.ListNotificationChannelDescriptorsRequest, opts ...gax.CallOption) *NotificationChannelDescriptorIterator {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListNotificationChannelDescriptors[0:len(c.CallOptions.ListNotificationChannelDescriptors):len(c.CallOptions.ListNotificationChannelDescriptors)], opts...)
|
||||
it := &NotificationChannelDescriptorIterator{}
|
||||
req = proto.Clone(req).(*monitoringpb.ListNotificationChannelDescriptorsRequest)
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoringpb.NotificationChannelDescriptor, string, error) {
|
||||
var resp *monitoringpb.ListNotificationChannelDescriptorsResponse
|
||||
req.PageToken = pageToken
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.notificationChannelClient.ListNotificationChannelDescriptors(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return resp.ChannelDescriptors, 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)
|
||||
it.pageInfo.MaxSize = int(req.PageSize)
|
||||
return it
|
||||
}
|
||||
|
||||
// GetNotificationChannelDescriptor gets a single channel descriptor. The descriptor indicates which fields
|
||||
// are expected / permitted for a notification channel of the given type.
|
||||
func (c *NotificationChannelClient) GetNotificationChannelDescriptor(ctx context.Context, req *monitoringpb.GetNotificationChannelDescriptorRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannelDescriptor, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.GetNotificationChannelDescriptor[0:len(c.CallOptions.GetNotificationChannelDescriptor):len(c.CallOptions.GetNotificationChannelDescriptor)], opts...)
|
||||
var resp *monitoringpb.NotificationChannelDescriptor
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.notificationChannelClient.GetNotificationChannelDescriptor(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// ListNotificationChannels lists the notification channels that have been created for the project.
|
||||
func (c *NotificationChannelClient) ListNotificationChannels(ctx context.Context, req *monitoringpb.ListNotificationChannelsRequest, opts ...gax.CallOption) *NotificationChannelIterator {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListNotificationChannels[0:len(c.CallOptions.ListNotificationChannels):len(c.CallOptions.ListNotificationChannels)], opts...)
|
||||
it := &NotificationChannelIterator{}
|
||||
req = proto.Clone(req).(*monitoringpb.ListNotificationChannelsRequest)
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoringpb.NotificationChannel, string, error) {
|
||||
var resp *monitoringpb.ListNotificationChannelsResponse
|
||||
req.PageToken = pageToken
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.notificationChannelClient.ListNotificationChannels(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return resp.NotificationChannels, 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)
|
||||
it.pageInfo.MaxSize = int(req.PageSize)
|
||||
return it
|
||||
}
|
||||
|
||||
// GetNotificationChannel gets a single notification channel. The channel includes the relevant
|
||||
// configuration details with which the channel was created. However, the
|
||||
// response may truncate or omit passwords, API keys, or other private key
|
||||
// matter and thus the response may not be 100% identical to the information
|
||||
// that was supplied in the call to the create method.
|
||||
func (c *NotificationChannelClient) GetNotificationChannel(ctx context.Context, req *monitoringpb.GetNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.GetNotificationChannel[0:len(c.CallOptions.GetNotificationChannel):len(c.CallOptions.GetNotificationChannel)], opts...)
|
||||
var resp *monitoringpb.NotificationChannel
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.notificationChannelClient.GetNotificationChannel(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// CreateNotificationChannel creates a new notification channel, representing a single notification
|
||||
// endpoint such as an email address, SMS number, or pagerduty service.
|
||||
func (c *NotificationChannelClient) CreateNotificationChannel(ctx context.Context, req *monitoringpb.CreateNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.CreateNotificationChannel[0:len(c.CallOptions.CreateNotificationChannel):len(c.CallOptions.CreateNotificationChannel)], opts...)
|
||||
var resp *monitoringpb.NotificationChannel
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.notificationChannelClient.CreateNotificationChannel(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// UpdateNotificationChannel updates a notification channel. Fields not specified in the field mask
|
||||
// remain unchanged.
|
||||
func (c *NotificationChannelClient) UpdateNotificationChannel(ctx context.Context, req *monitoringpb.UpdateNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.UpdateNotificationChannel[0:len(c.CallOptions.UpdateNotificationChannel):len(c.CallOptions.UpdateNotificationChannel)], opts...)
|
||||
var resp *monitoringpb.NotificationChannel
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.notificationChannelClient.UpdateNotificationChannel(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// DeleteNotificationChannel deletes a notification channel.
|
||||
func (c *NotificationChannelClient) DeleteNotificationChannel(ctx context.Context, req *monitoringpb.DeleteNotificationChannelRequest, opts ...gax.CallOption) error {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.DeleteNotificationChannel[0:len(c.CallOptions.DeleteNotificationChannel):len(c.CallOptions.DeleteNotificationChannel)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
_, err = c.notificationChannelClient.DeleteNotificationChannel(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
return err
|
||||
}
|
||||
|
||||
// NotificationChannelDescriptorIterator manages a stream of *monitoringpb.NotificationChannelDescriptor.
|
||||
type NotificationChannelDescriptorIterator struct {
|
||||
items []*monitoringpb.NotificationChannelDescriptor
|
||||
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 []*monitoringpb.NotificationChannelDescriptor, nextPageToken string, err error)
|
||||
}
|
||||
|
||||
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
|
||||
func (it *NotificationChannelDescriptorIterator) 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 *NotificationChannelDescriptorIterator) Next() (*monitoringpb.NotificationChannelDescriptor, error) {
|
||||
var item *monitoringpb.NotificationChannelDescriptor
|
||||
if err := it.nextFunc(); err != nil {
|
||||
return item, err
|
||||
}
|
||||
item = it.items[0]
|
||||
it.items = it.items[1:]
|
||||
return item, nil
|
||||
}
|
||||
|
||||
func (it *NotificationChannelDescriptorIterator) bufLen() int {
|
||||
return len(it.items)
|
||||
}
|
||||
|
||||
func (it *NotificationChannelDescriptorIterator) takeBuf() interface{} {
|
||||
b := it.items
|
||||
it.items = nil
|
||||
return b
|
||||
}
|
||||
|
||||
// NotificationChannelIterator manages a stream of *monitoringpb.NotificationChannel.
|
||||
type NotificationChannelIterator struct {
|
||||
items []*monitoringpb.NotificationChannel
|
||||
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 []*monitoringpb.NotificationChannel, nextPageToken string, err error)
|
||||
}
|
||||
|
||||
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
|
||||
func (it *NotificationChannelIterator) 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 *NotificationChannelIterator) Next() (*monitoringpb.NotificationChannel, error) {
|
||||
var item *monitoringpb.NotificationChannel
|
||||
if err := it.nextFunc(); err != nil {
|
||||
return item, err
|
||||
}
|
||||
item = it.items[0]
|
||||
it.items = it.items[1:]
|
||||
return item, nil
|
||||
}
|
||||
|
||||
func (it *NotificationChannelIterator) bufLen() int {
|
||||
return len(it.items)
|
||||
}
|
||||
|
||||
func (it *NotificationChannelIterator) takeBuf() interface{} {
|
||||
b := it.items
|
||||
it.items = nil
|
||||
return b
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://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 monitoring
|
||||
|
||||
// GroupProjectPath returns the path for the project resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("projects/%s", project)
|
||||
// instead.
|
||||
func GroupProjectPath(project string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
""
|
||||
}
|
||||
|
||||
// GroupGroupPath returns the path for the group resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("projects/%s/groups/%s", project, group)
|
||||
// instead.
|
||||
func GroupGroupPath(project, group string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
"/groups/" +
|
||||
group +
|
||||
""
|
||||
}
|
||||
|
||||
// MetricProjectPath returns the path for the project resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("projects/%s", project)
|
||||
// instead.
|
||||
func MetricProjectPath(project string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
""
|
||||
}
|
||||
|
||||
// MetricMetricDescriptorPath returns the path for the metric descriptor resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("projects/%s/metricDescriptors/%s", project, metricDescriptor)
|
||||
// instead.
|
||||
func MetricMetricDescriptorPath(project, metricDescriptor string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
"/metricDescriptors/" +
|
||||
metricDescriptor +
|
||||
""
|
||||
}
|
||||
|
||||
// MetricMonitoredResourceDescriptorPath returns the path for the monitored resource descriptor resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("projects/%s/monitoredResourceDescriptors/%s", project, monitoredResourceDescriptor)
|
||||
// instead.
|
||||
func MetricMonitoredResourceDescriptorPath(project, monitoredResourceDescriptor string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
"/monitoredResourceDescriptors/" +
|
||||
monitoredResourceDescriptor +
|
||||
""
|
||||
}
|
||||
|
||||
// UptimeCheckProjectPath returns the path for the project resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("projects/%s", project)
|
||||
// instead.
|
||||
func UptimeCheckProjectPath(project string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
""
|
||||
}
|
||||
|
||||
// UptimeCheckUptimeCheckConfigPath returns the path for the uptime check config resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("projects/%s/uptimeCheckConfigs/%s", project, uptimeCheckConfig)
|
||||
// instead.
|
||||
func UptimeCheckUptimeCheckConfigPath(project, uptimeCheckConfig string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
"/uptimeCheckConfigs/" +
|
||||
uptimeCheckConfig +
|
||||
""
|
||||
}
|
||||
+362
@@ -0,0 +1,362 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://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 monitoring
|
||||
|
||||
import (
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"cloud.google.com/go/internal/version"
|
||||
"github.com/golang/protobuf/proto"
|
||||
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"
|
||||
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
// UptimeCheckCallOptions contains the retry settings for each method of UptimeCheckClient.
|
||||
type UptimeCheckCallOptions struct {
|
||||
ListUptimeCheckConfigs []gax.CallOption
|
||||
GetUptimeCheckConfig []gax.CallOption
|
||||
CreateUptimeCheckConfig []gax.CallOption
|
||||
UpdateUptimeCheckConfig []gax.CallOption
|
||||
DeleteUptimeCheckConfig []gax.CallOption
|
||||
ListUptimeCheckIps []gax.CallOption
|
||||
}
|
||||
|
||||
func defaultUptimeCheckClientOptions() []option.ClientOption {
|
||||
return []option.ClientOption{
|
||||
option.WithEndpoint("monitoring.googleapis.com:443"),
|
||||
option.WithScopes(DefaultAuthScopes()...),
|
||||
}
|
||||
}
|
||||
|
||||
func defaultUptimeCheckCallOptions() *UptimeCheckCallOptions {
|
||||
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: 60000 * time.Millisecond,
|
||||
Multiplier: 1.3,
|
||||
})
|
||||
}),
|
||||
},
|
||||
}
|
||||
return &UptimeCheckCallOptions{
|
||||
ListUptimeCheckConfigs: retry[[2]string{"default", "idempotent"}],
|
||||
GetUptimeCheckConfig: retry[[2]string{"default", "idempotent"}],
|
||||
CreateUptimeCheckConfig: retry[[2]string{"default", "non_idempotent"}],
|
||||
UpdateUptimeCheckConfig: retry[[2]string{"default", "non_idempotent"}],
|
||||
DeleteUptimeCheckConfig: retry[[2]string{"default", "idempotent"}],
|
||||
ListUptimeCheckIps: retry[[2]string{"default", "idempotent"}],
|
||||
}
|
||||
}
|
||||
|
||||
// UptimeCheckClient is a client for interacting with Stackdriver Monitoring API.
|
||||
//
|
||||
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
|
||||
type UptimeCheckClient struct {
|
||||
// The connection to the service.
|
||||
conn *grpc.ClientConn
|
||||
|
||||
// The gRPC API client.
|
||||
uptimeCheckClient monitoringpb.UptimeCheckServiceClient
|
||||
|
||||
// The call options for this service.
|
||||
CallOptions *UptimeCheckCallOptions
|
||||
|
||||
// The x-goog-* metadata to be sent with each request.
|
||||
xGoogMetadata metadata.MD
|
||||
}
|
||||
|
||||
// NewUptimeCheckClient creates a new uptime check service client.
|
||||
//
|
||||
// The UptimeCheckService API is used to manage (list, create, delete, edit)
|
||||
// uptime check configurations in the Stackdriver Monitoring product. An uptime
|
||||
// check is a piece of configuration that determines which resources and
|
||||
// services to monitor for availability. These configurations can also be
|
||||
// configured interactively by navigating to the [Cloud Console]
|
||||
// (http://console.cloud.google.com), selecting the appropriate project,
|
||||
// clicking on "Monitoring" on the left-hand side to navigate to Stackdriver,
|
||||
// and then clicking on "Uptime".
|
||||
func NewUptimeCheckClient(ctx context.Context, opts ...option.ClientOption) (*UptimeCheckClient, error) {
|
||||
conn, err := transport.DialGRPC(ctx, append(defaultUptimeCheckClientOptions(), opts...)...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c := &UptimeCheckClient{
|
||||
conn: conn,
|
||||
CallOptions: defaultUptimeCheckCallOptions(),
|
||||
|
||||
uptimeCheckClient: monitoringpb.NewUptimeCheckServiceClient(conn),
|
||||
}
|
||||
c.setGoogleClientInfo()
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// Connection returns the client's connection to the API service.
|
||||
func (c *UptimeCheckClient) 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 *UptimeCheckClient) 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 *UptimeCheckClient) setGoogleClientInfo(keyval ...string) {
|
||||
kv := append([]string{"gl-go", version.Go()}, keyval...)
|
||||
kv = append(kv, "gapic", version.Repo, "gax", gax.Version, "grpc", grpc.Version)
|
||||
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
||||
// ListUptimeCheckConfigs lists the existing valid uptime check configurations for the project,
|
||||
// leaving out any invalid configurations.
|
||||
func (c *UptimeCheckClient) ListUptimeCheckConfigs(ctx context.Context, req *monitoringpb.ListUptimeCheckConfigsRequest, opts ...gax.CallOption) *UptimeCheckConfigIterator {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListUptimeCheckConfigs[0:len(c.CallOptions.ListUptimeCheckConfigs):len(c.CallOptions.ListUptimeCheckConfigs)], opts...)
|
||||
it := &UptimeCheckConfigIterator{}
|
||||
req = proto.Clone(req).(*monitoringpb.ListUptimeCheckConfigsRequest)
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoringpb.UptimeCheckConfig, string, error) {
|
||||
var resp *monitoringpb.ListUptimeCheckConfigsResponse
|
||||
req.PageToken = pageToken
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.uptimeCheckClient.ListUptimeCheckConfigs(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return resp.UptimeCheckConfigs, 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)
|
||||
it.pageInfo.MaxSize = int(req.PageSize)
|
||||
return it
|
||||
}
|
||||
|
||||
// GetUptimeCheckConfig gets a single uptime check configuration.
|
||||
func (c *UptimeCheckClient) GetUptimeCheckConfig(ctx context.Context, req *monitoringpb.GetUptimeCheckConfigRequest, opts ...gax.CallOption) (*monitoringpb.UptimeCheckConfig, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.GetUptimeCheckConfig[0:len(c.CallOptions.GetUptimeCheckConfig):len(c.CallOptions.GetUptimeCheckConfig)], opts...)
|
||||
var resp *monitoringpb.UptimeCheckConfig
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.uptimeCheckClient.GetUptimeCheckConfig(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// CreateUptimeCheckConfig creates a new uptime check configuration.
|
||||
func (c *UptimeCheckClient) CreateUptimeCheckConfig(ctx context.Context, req *monitoringpb.CreateUptimeCheckConfigRequest, opts ...gax.CallOption) (*monitoringpb.UptimeCheckConfig, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.CreateUptimeCheckConfig[0:len(c.CallOptions.CreateUptimeCheckConfig):len(c.CallOptions.CreateUptimeCheckConfig)], opts...)
|
||||
var resp *monitoringpb.UptimeCheckConfig
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.uptimeCheckClient.CreateUptimeCheckConfig(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// UpdateUptimeCheckConfig updates an uptime check configuration. You can either replace the entire
|
||||
// configuration with a new one or replace only certain fields in the current
|
||||
// configuration by specifying the fields to be updated via "updateMask".
|
||||
// Returns the updated configuration.
|
||||
func (c *UptimeCheckClient) UpdateUptimeCheckConfig(ctx context.Context, req *monitoringpb.UpdateUptimeCheckConfigRequest, opts ...gax.CallOption) (*monitoringpb.UptimeCheckConfig, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.UpdateUptimeCheckConfig[0:len(c.CallOptions.UpdateUptimeCheckConfig):len(c.CallOptions.UpdateUptimeCheckConfig)], opts...)
|
||||
var resp *monitoringpb.UptimeCheckConfig
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.uptimeCheckClient.UpdateUptimeCheckConfig(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// DeleteUptimeCheckConfig deletes an uptime check configuration. Note that this method will fail
|
||||
// if the uptime check configuration is referenced by an alert policy or
|
||||
// other dependent configs that would be rendered invalid by the deletion.
|
||||
func (c *UptimeCheckClient) DeleteUptimeCheckConfig(ctx context.Context, req *monitoringpb.DeleteUptimeCheckConfigRequest, opts ...gax.CallOption) error {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.DeleteUptimeCheckConfig[0:len(c.CallOptions.DeleteUptimeCheckConfig):len(c.CallOptions.DeleteUptimeCheckConfig)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
_, err = c.uptimeCheckClient.DeleteUptimeCheckConfig(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
return err
|
||||
}
|
||||
|
||||
// ListUptimeCheckIps returns the list of IPs that checkers run from
|
||||
func (c *UptimeCheckClient) ListUptimeCheckIps(ctx context.Context, req *monitoringpb.ListUptimeCheckIpsRequest, opts ...gax.CallOption) *UptimeCheckIpIterator {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListUptimeCheckIps[0:len(c.CallOptions.ListUptimeCheckIps):len(c.CallOptions.ListUptimeCheckIps)], opts...)
|
||||
it := &UptimeCheckIpIterator{}
|
||||
req = proto.Clone(req).(*monitoringpb.ListUptimeCheckIpsRequest)
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoringpb.UptimeCheckIp, string, error) {
|
||||
var resp *monitoringpb.ListUptimeCheckIpsResponse
|
||||
req.PageToken = pageToken
|
||||
if pageSize > math.MaxInt32 {
|
||||
req.PageSize = math.MaxInt32
|
||||
} else {
|
||||
req.PageSize = int32(pageSize)
|
||||
}
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.uptimeCheckClient.ListUptimeCheckIps(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return resp.UptimeCheckIps, 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)
|
||||
it.pageInfo.MaxSize = int(req.PageSize)
|
||||
return it
|
||||
}
|
||||
|
||||
// UptimeCheckConfigIterator manages a stream of *monitoringpb.UptimeCheckConfig.
|
||||
type UptimeCheckConfigIterator struct {
|
||||
items []*monitoringpb.UptimeCheckConfig
|
||||
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 []*monitoringpb.UptimeCheckConfig, nextPageToken string, err error)
|
||||
}
|
||||
|
||||
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
|
||||
func (it *UptimeCheckConfigIterator) 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 *UptimeCheckConfigIterator) Next() (*monitoringpb.UptimeCheckConfig, error) {
|
||||
var item *monitoringpb.UptimeCheckConfig
|
||||
if err := it.nextFunc(); err != nil {
|
||||
return item, err
|
||||
}
|
||||
item = it.items[0]
|
||||
it.items = it.items[1:]
|
||||
return item, nil
|
||||
}
|
||||
|
||||
func (it *UptimeCheckConfigIterator) bufLen() int {
|
||||
return len(it.items)
|
||||
}
|
||||
|
||||
func (it *UptimeCheckConfigIterator) takeBuf() interface{} {
|
||||
b := it.items
|
||||
it.items = nil
|
||||
return b
|
||||
}
|
||||
|
||||
// UptimeCheckIpIterator manages a stream of *monitoringpb.UptimeCheckIp.
|
||||
type UptimeCheckIpIterator struct {
|
||||
items []*monitoringpb.UptimeCheckIp
|
||||
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 []*monitoringpb.UptimeCheckIp, nextPageToken string, err error)
|
||||
}
|
||||
|
||||
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
|
||||
func (it *UptimeCheckIpIterator) 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 *UptimeCheckIpIterator) Next() (*monitoringpb.UptimeCheckIp, error) {
|
||||
var item *monitoringpb.UptimeCheckIp
|
||||
if err := it.nextFunc(); err != nil {
|
||||
return item, err
|
||||
}
|
||||
item = it.items[0]
|
||||
it.items = it.items[1:]
|
||||
return item, nil
|
||||
}
|
||||
|
||||
func (it *UptimeCheckIpIterator) bufLen() int {
|
||||
return len(it.items)
|
||||
}
|
||||
|
||||
func (it *UptimeCheckIpIterator) takeBuf() interface{} {
|
||||
b := it.items
|
||||
it.items = nil
|
||||
return b
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://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 trace is an auto-generated package for the
|
||||
// Stackdriver Trace API.
|
||||
//
|
||||
// NOTE: This package is in alpha. It is not stable, and is likely to change.
|
||||
//
|
||||
// Sends application trace data to Stackdriver Trace for viewing. Trace data
|
||||
// is
|
||||
// collected for all App Engine applications by default. Trace data from
|
||||
// other
|
||||
// applications can be provided using this API.
|
||||
package trace // import "cloud.google.com/go/trace/apiv2"
|
||||
|
||||
import (
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
|
||||
out, _ := metadata.FromOutgoingContext(ctx)
|
||||
out = out.Copy()
|
||||
for _, md := range mds {
|
||||
for k, v := range md {
|
||||
out[k] = append(out[k], v...)
|
||||
}
|
||||
}
|
||||
return metadata.NewOutgoingContext(ctx, out)
|
||||
}
|
||||
|
||||
// DefaultAuthScopes reports the default set of authentication scopes to use with this package.
|
||||
func DefaultAuthScopes() []string {
|
||||
return []string{
|
||||
"https://www.googleapis.com/auth/cloud-platform",
|
||||
"https://www.googleapis.com/auth/trace.append",
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://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 trace
|
||||
|
||||
// ProjectPath returns the path for the project resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("projects/%s", project)
|
||||
// instead.
|
||||
func ProjectPath(project string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
""
|
||||
}
|
||||
|
||||
// SpanPath returns the path for the span resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("projects/%s/traces/%s/spans/%s", project, trace, span)
|
||||
// instead.
|
||||
func SpanPath(project, trace, span string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
"/traces/" +
|
||||
trace +
|
||||
"/spans/" +
|
||||
span +
|
||||
""
|
||||
}
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://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 trace
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"cloud.google.com/go/internal/version"
|
||||
gax "github.com/googleapis/gax-go"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/api/option"
|
||||
"google.golang.org/api/transport"
|
||||
cloudtracepb "google.golang.org/genproto/googleapis/devtools/cloudtrace/v2"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
// CallOptions contains the retry settings for each method of Client.
|
||||
type CallOptions struct {
|
||||
BatchWriteSpans []gax.CallOption
|
||||
CreateSpan []gax.CallOption
|
||||
}
|
||||
|
||||
func defaultClientOptions() []option.ClientOption {
|
||||
return []option.ClientOption{
|
||||
option.WithEndpoint("cloudtrace.googleapis.com:443"),
|
||||
option.WithScopes(DefaultAuthScopes()...),
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
})
|
||||
}),
|
||||
},
|
||||
}
|
||||
return &CallOptions{
|
||||
BatchWriteSpans: retry[[2]string{"default", "non_idempotent"}],
|
||||
CreateSpan: retry[[2]string{"default", "idempotent"}],
|
||||
}
|
||||
}
|
||||
|
||||
// Client is a client for interacting with Stackdriver Trace API.
|
||||
//
|
||||
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
|
||||
type Client struct {
|
||||
// The connection to the service.
|
||||
conn *grpc.ClientConn
|
||||
|
||||
// The gRPC API client.
|
||||
client cloudtracepb.TraceServiceClient
|
||||
|
||||
// The call options for this service.
|
||||
CallOptions *CallOptions
|
||||
|
||||
// The x-goog-* metadata to be sent with each request.
|
||||
xGoogMetadata metadata.MD
|
||||
}
|
||||
|
||||
// NewClient creates a new trace service client.
|
||||
//
|
||||
// This file describes an API for collecting and viewing traces and spans
|
||||
// within a trace. A Trace is a collection of spans corresponding to a single
|
||||
// operation or set of operations for an application. A span is an individual
|
||||
// timed event which forms a node of the trace tree. A single trace may
|
||||
// contain span(s) from multiple services.
|
||||
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: cloudtracepb.NewTraceServiceClient(conn),
|
||||
}
|
||||
c.setGoogleClientInfo()
|
||||
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(keyval ...string) {
|
||||
kv := append([]string{"gl-go", version.Go()}, keyval...)
|
||||
kv = append(kv, "gapic", version.Repo, "gax", gax.Version, "grpc", grpc.Version)
|
||||
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
||||
// BatchWriteSpans sends new spans to new or existing traces. You cannot update
|
||||
// existing spans.
|
||||
func (c *Client) BatchWriteSpans(ctx context.Context, req *cloudtracepb.BatchWriteSpansRequest, opts ...gax.CallOption) error {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.BatchWriteSpans[0:len(c.CallOptions.BatchWriteSpans):len(c.CallOptions.BatchWriteSpans)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
_, err = c.client.BatchWriteSpans(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
return err
|
||||
}
|
||||
|
||||
// CreateSpan creates a new span.
|
||||
func (c *Client) CreateSpan(ctx context.Context, req *cloudtracepb.Span, opts ...gax.CallOption) (*cloudtracepb.Span, error) {
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.CreateSpan[0:len(c.CallOptions.CreateSpan):len(c.CallOptions.CreateSpan)], opts...)
|
||||
var resp *cloudtracepb.Span
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
resp, err = c.client.CreateSpan(ctx, req, settings.GRPC...)
|
||||
return err
|
||||
}, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
/vendor/
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.10.x
|
||||
|
||||
go_import_path: contrib.go.opencensus.io/exporter/stackdriver
|
||||
|
||||
before_script:
|
||||
- GO_FILES=$(find . -iname '*.go' | grep -v /vendor/) # All the .go files, excluding vendor/ if any
|
||||
- PKGS=$(go list ./... | grep -v /vendor/) # All the import paths, excluding vendor/ if any
|
||||
|
||||
script:
|
||||
- go build ./... # Ensure dependency updates don't break build
|
||||
- if [ -n "$(gofmt -s -l $GO_FILES)" ]; then echo "gofmt the following files:"; gofmt -s -l $GO_FILES; exit 1; fi
|
||||
- go vet ./...
|
||||
- go test -v -race $PKGS # Run all the tests with the race detector enabled
|
||||
- 'if [[ $TRAVIS_GO_VERSION = 1.8* ]]; then ! golint ./... | grep -vE "(_mock|_string|\.pb)\.go:"; fi'
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
# How to contribute
|
||||
|
||||
We'd love to accept your patches and contributions to this project. There are
|
||||
just a few small guidelines you need to follow.
|
||||
|
||||
## Contributor License Agreement
|
||||
|
||||
Contributions to this project must be accompanied by a Contributor License
|
||||
Agreement. You (or your employer) retain the copyright to your contribution,
|
||||
this simply gives us permission to use and redistribute your contributions as
|
||||
part of the project. Head over to <https://cla.developers.google.com/> to see
|
||||
your current agreements on file or to sign a new one.
|
||||
|
||||
You generally only need to submit a CLA once, so if you've already submitted one
|
||||
(even if it was for a different project), you probably don't need to do it
|
||||
again.
|
||||
|
||||
## Code reviews
|
||||
|
||||
All submissions, including submissions by project members, require review. We
|
||||
use GitHub pull requests for this purpose. Consult [GitHub Help] for more
|
||||
information on using pull requests.
|
||||
|
||||
[GitHub Help]: https://help.github.com/articles/about-pull-requests/
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
|
||||
|
||||
[[projects]]
|
||||
name = "cloud.google.com/go"
|
||||
packages = ["compute/metadata","internal/version","monitoring/apiv3","trace/apiv2"]
|
||||
revision = "0fd7230b2a7505833d5f69b75cbd6c9582401479"
|
||||
version = "v0.23.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/golang/protobuf"
|
||||
packages = ["proto","protoc-gen-go/descriptor","ptypes","ptypes/any","ptypes/duration","ptypes/empty","ptypes/struct","ptypes/timestamp","ptypes/wrappers"]
|
||||
revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/googleapis/gax-go"
|
||||
packages = ["."]
|
||||
revision = "317e0006254c44a0ac427cc52a0e083ff0b9622f"
|
||||
version = "v2.0.0"
|
||||
|
||||
[[projects]]
|
||||
name = "go.opencensus.io"
|
||||
packages = [".","exporter/stackdriver/propagation","exporterutil","internal","internal/tagencoding","plugin/ocgrpc","plugin/ochttp","plugin/ochttp/propagation/b3","stats","stats/internal","stats/view","tag","trace","trace/internal","trace/propagation"]
|
||||
revision = "5897c5ce32247fc8af19c7710abd96e3304fb43c"
|
||||
version = "v0.12.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/net"
|
||||
packages = ["context","context/ctxhttp","http/httpguts","http2","http2/hpack","idna","internal/timeseries","trace"]
|
||||
revision = "1e491301e022f8f977054da4c2d852decd59571f"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/oauth2"
|
||||
packages = [".","google","internal","jws","jwt"]
|
||||
revision = "1e0a3fa8ba9a5c9eb35c271780101fdaf1b205d7"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/sync"
|
||||
packages = ["semaphore"]
|
||||
revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca"
|
||||
|
||||
[[projects]]
|
||||
name = "golang.org/x/text"
|
||||
packages = ["collate","collate/build","internal/colltab","internal/gen","internal/tag","internal/triegen","internal/ucd","language","secure/bidirule","transform","unicode/bidi","unicode/cldr","unicode/norm","unicode/rangetable"]
|
||||
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
|
||||
version = "v0.3.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "google.golang.org/api"
|
||||
packages = ["googleapi/transport","internal","iterator","option","support/bundler","transport","transport/grpc","transport/http"]
|
||||
revision = "8e296ef260056b6323d10727db40512dac6d92d5"
|
||||
|
||||
[[projects]]
|
||||
name = "google.golang.org/appengine"
|
||||
packages = [".","internal","internal/app_identity","internal/base","internal/datastore","internal/log","internal/modules","internal/remote_api","internal/socket","internal/urlfetch","socket","urlfetch"]
|
||||
revision = "150dc57a1b433e64154302bdc40b6bb8aefa313a"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "google.golang.org/genproto"
|
||||
packages = ["googleapis/api/annotations","googleapis/api/distribution","googleapis/api/label","googleapis/api/metric","googleapis/api/monitoredres","googleapis/devtools/cloudtrace/v2","googleapis/monitoring/v3","googleapis/rpc/code","googleapis/rpc/status","protobuf/field_mask"]
|
||||
revision = "81158efcc9f219c511e4d3c0d61a0e6e49c01a24"
|
||||
|
||||
[[projects]]
|
||||
name = "google.golang.org/grpc"
|
||||
packages = [".","balancer","balancer/base","balancer/roundrobin","channelz","codes","connectivity","credentials","credentials/oauth","encoding","encoding/proto","grpclb/grpc_lb_v1/messages","grpclog","internal","keepalive","metadata","naming","peer","resolver","resolver/dns","resolver/passthrough","stats","status","tap","transport"]
|
||||
revision = "41344da2231b913fa3d983840a57a6b1b7b631a1"
|
||||
version = "v1.12.0"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "d587e278f7302f82cb7f5c14e5e7ce831c84f198c05ede6c16a8afa4d6112f9e"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
# Gopkg.toml example
|
||||
#
|
||||
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
|
||||
# for detailed Gopkg.toml documentation.
|
||||
#
|
||||
# required = ["github.com/user/thing/cmd/thing"]
|
||||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
|
||||
#
|
||||
# [[constraint]]
|
||||
# name = "github.com/user/project"
|
||||
# version = "1.0.0"
|
||||
#
|
||||
# [[constraint]]
|
||||
# name = "github.com/user/project2"
|
||||
# branch = "dev"
|
||||
# source = "github.com/myfork/project2"
|
||||
#
|
||||
# [[override]]
|
||||
# name = "github.com/x/y"
|
||||
# version = "2.4.0"
|
||||
#
|
||||
# [prune]
|
||||
# non-go = false
|
||||
# go-tests = true
|
||||
# unused-packages = true
|
||||
|
||||
|
||||
[[constraint]]
|
||||
name = "cloud.google.com/go"
|
||||
version = ">=0.23.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/golang/protobuf"
|
||||
version = "1.1.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "go.opencensus.io"
|
||||
version = ">=0.12.0"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/net"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/oauth2"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "google.golang.org/api"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "google.golang.org/genproto"
|
||||
|
||||
[[constraint]]
|
||||
name = "google.golang.org/grpc"
|
||||
version = "1.12.0"
|
||||
|
||||
[prune]
|
||||
go-tests = true
|
||||
unused-packages = true
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
# OpenCensus Go Stackdriver
|
||||
|
||||
[](https://travis-ci.org/census-ecosystem/opencensus-go-exporter-stackdriver) [![GoDoc][godoc-image]][godoc-url]
|
||||
|
||||
Provides OpenCensus exporter support for Stackdriver Monitoring and Stackdriver Trace.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
$ go get -u contrib.go.opencensus.io/exporter/stackdriver
|
||||
```
|
||||
|
||||
[godoc-image]: https://godoc.org/contrib.go.opencensus.io/exporter/stackdriver?status.svg
|
||||
[godoc-url]: https://godoc.org/contrib.go.opencensus.io/exporter/stackdriver
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// Copyright 2018, OpenCensus Authors
|
||||
//
|
||||
// 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 stackdriver
|
||||
|
||||
// Labels represents a set of Stackdriver Monitoring labels.
|
||||
type Labels struct {
|
||||
m map[string]labelValue
|
||||
}
|
||||
|
||||
type labelValue struct {
|
||||
val, desc string
|
||||
}
|
||||
|
||||
// Set stores a label with the given key, value and description,
|
||||
// overwriting any previous values with the given key.
|
||||
func (labels *Labels) Set(key, value, description string) {
|
||||
if labels.m == nil {
|
||||
labels.m = make(map[string]labelValue)
|
||||
}
|
||||
labels.m[key] = labelValue{value, description}
|
||||
}
|
||||
Generated
Vendored
+53
@@ -0,0 +1,53 @@
|
||||
// Copyright 2018, OpenCensus Authors
|
||||
//
|
||||
// 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 monitoredresource
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws/ec2metadata"
|
||||
"github.com/aws/aws-sdk-go/aws/session"
|
||||
)
|
||||
|
||||
// awsIdentityDocument is used to store parsed AWS Identity Document.
|
||||
type awsIdentityDocument struct {
|
||||
// accountID is the AWS account number for the VM.
|
||||
accountID string
|
||||
|
||||
// instanceID is the instance id of the instance.
|
||||
instanceID string
|
||||
|
||||
// Region is the AWS region for the VM.
|
||||
region string
|
||||
}
|
||||
|
||||
// retrieveAWSIdentityDocument attempts to retrieve AWS Identity Document.
|
||||
// If the environment is AWS EC2 Instance then a valid document is retrieved.
|
||||
// Relevant attributes from the document are stored in awsIdentityDoc.
|
||||
// This is only done once.
|
||||
func retrieveAWSIdentityDocument() *awsIdentityDocument {
|
||||
awsIdentityDoc := awsIdentityDocument{}
|
||||
c := ec2metadata.New(session.New())
|
||||
if c.Available() == false {
|
||||
return nil
|
||||
}
|
||||
ec2InstanceIdentifyDocument, err := c.GetInstanceIdentityDocument()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
awsIdentityDoc.region = ec2InstanceIdentifyDocument.Region
|
||||
awsIdentityDoc.instanceID = ec2InstanceIdentifyDocument.InstanceID
|
||||
awsIdentityDoc.accountID = ec2InstanceIdentifyDocument.AccountID
|
||||
|
||||
return &awsIdentityDoc
|
||||
}
|
||||
Generated
Vendored
+90
@@ -0,0 +1,90 @@
|
||||
// Copyright 2018, OpenCensus Authors
|
||||
//
|
||||
// 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 monitoredresource
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"cloud.google.com/go/compute/metadata"
|
||||
)
|
||||
|
||||
// gcpMetadata represents metadata retrieved from GCP (GKE and GCE) environment.
|
||||
type gcpMetadata struct {
|
||||
|
||||
// projectID is the identifier of the GCP project associated with this resource, such as "my-project".
|
||||
projectID string
|
||||
|
||||
// instanceID is the numeric VM instance identifier assigned by Compute Engine.
|
||||
instanceID string
|
||||
|
||||
// clusterName is the name for the cluster the container is running in.
|
||||
clusterName string
|
||||
|
||||
// containerName is the name of the container.
|
||||
containerName string
|
||||
|
||||
// namespaceID is the identifier for the cluster namespace the container is running in
|
||||
namespaceID string
|
||||
|
||||
// podID is the identifier for the pod the container is running in.
|
||||
podID string
|
||||
|
||||
// zone is the Compute Engine zone in which the VM is running.
|
||||
zone string
|
||||
}
|
||||
|
||||
// retrieveGCPMetadata retrieves value of each Attribute from Metadata Server
|
||||
// in GKE container and GCE instance environment.
|
||||
// Some attributes are retrieved from the system environment.
|
||||
// This is only executed detectOnce.
|
||||
func retrieveGCPMetadata() *gcpMetadata {
|
||||
gcpMetadata := gcpMetadata{}
|
||||
var err error
|
||||
gcpMetadata.instanceID, err = metadata.InstanceID()
|
||||
if err != nil {
|
||||
// Not a GCP environment
|
||||
return &gcpMetadata
|
||||
}
|
||||
|
||||
gcpMetadata.projectID, err = metadata.ProjectID()
|
||||
logError(err)
|
||||
|
||||
gcpMetadata.zone, err = metadata.Zone()
|
||||
logError(err)
|
||||
|
||||
clusterName, err := metadata.InstanceAttributeValue("cluster-name")
|
||||
logError(err)
|
||||
gcpMetadata.clusterName = strings.TrimSpace(clusterName)
|
||||
|
||||
// Following attributes are derived from environment variables. They are configured
|
||||
// via yaml file. For details refer to:
|
||||
// https://cloud.google.com/kubernetes-engine/docs/tutorials/custom-metrics-autoscaling#exporting_metrics_from_the_application
|
||||
gcpMetadata.namespaceID = os.Getenv("NAMESPACE")
|
||||
gcpMetadata.containerName = os.Getenv("CONTAINER_NAME")
|
||||
gcpMetadata.podID = os.Getenv("HOSTNAME")
|
||||
|
||||
return &gcpMetadata
|
||||
}
|
||||
|
||||
// logError logs error only if the error is present and it is not 'not defined'
|
||||
func logError(err error) {
|
||||
if err != nil {
|
||||
if !strings.Contains(err.Error(), "not defined") {
|
||||
log.Printf("Error retrieving gcp metadata: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+217
@@ -0,0 +1,217 @@
|
||||
// Copyright 2018, OpenCensus Authors
|
||||
//
|
||||
// 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 monitoredresource
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Interface is a type that represent monitor resource that satisfies monitoredresource.Interface
|
||||
type Interface interface {
|
||||
|
||||
// MonitoredResource returns the resource type and resource labels.
|
||||
MonitoredResource() (resType string, labels map[string]string)
|
||||
}
|
||||
|
||||
// GKEContainer represents gke_container type monitored resource.
|
||||
// For definition refer to
|
||||
// https://cloud.google.com/monitoring/api/resources#tag_gke_container
|
||||
type GKEContainer struct {
|
||||
|
||||
// ProjectID is the identifier of the GCP project associated with this resource, such as "my-project".
|
||||
ProjectID string
|
||||
|
||||
// InstanceID is the numeric VM instance identifier assigned by Compute Engine.
|
||||
InstanceID string
|
||||
|
||||
// ClusterName is the name for the cluster the container is running in.
|
||||
ClusterName string
|
||||
|
||||
// ContainerName is the name of the container.
|
||||
ContainerName string
|
||||
|
||||
// NamespaceID is the identifier for the cluster namespace the container is running in
|
||||
NamespaceID string
|
||||
|
||||
// PodID is the identifier for the pod the container is running in.
|
||||
PodID string
|
||||
|
||||
// Zone is the Compute Engine zone in which the VM is running.
|
||||
Zone string
|
||||
}
|
||||
|
||||
// MonitoredResource returns resource type and resource labels for GKEContainer
|
||||
func (gke *GKEContainer) MonitoredResource() (resType string, labels map[string]string) {
|
||||
labels = map[string]string{
|
||||
"project_id": gke.ProjectID,
|
||||
"instance_id": gke.InstanceID,
|
||||
"zone": gke.Zone,
|
||||
"cluster_name": gke.ClusterName,
|
||||
"container_name": gke.ContainerName,
|
||||
"namespace_id": gke.NamespaceID,
|
||||
"pod_id": gke.PodID,
|
||||
}
|
||||
return "gke_container", labels
|
||||
}
|
||||
|
||||
// GCEInstance represents gce_instance type monitored resource.
|
||||
// For definition refer to
|
||||
// https://cloud.google.com/monitoring/api/resources#tag_gce_instance
|
||||
type GCEInstance struct {
|
||||
|
||||
// ProjectID is the identifier of the GCP project associated with this resource, such as "my-project".
|
||||
ProjectID string
|
||||
|
||||
// InstanceID is the numeric VM instance identifier assigned by Compute Engine.
|
||||
InstanceID string
|
||||
|
||||
// Zone is the Compute Engine zone in which the VM is running.
|
||||
Zone string
|
||||
}
|
||||
|
||||
// MonitoredResource returns resource type and resource labels for GCEInstance
|
||||
func (gce *GCEInstance) MonitoredResource() (resType string, labels map[string]string) {
|
||||
labels = map[string]string{
|
||||
"project_id": gce.ProjectID,
|
||||
"instance_id": gce.InstanceID,
|
||||
"zone": gce.Zone,
|
||||
}
|
||||
return "gce_instance", labels
|
||||
}
|
||||
|
||||
// AWSEC2Instance represents aws_ec2_instance type monitored resource.
|
||||
// For definition refer to
|
||||
// https://cloud.google.com/monitoring/api/resources#tag_aws_ec2_instance
|
||||
type AWSEC2Instance struct {
|
||||
|
||||
// AWSAccount is the AWS account number for the VM.
|
||||
AWSAccount string
|
||||
|
||||
// InstanceID is the instance id of the instance.
|
||||
InstanceID string
|
||||
|
||||
// Region is the AWS region for the VM. The format of this field is "aws:{region}",
|
||||
// where supported values for {region} are listed at
|
||||
// http://docs.aws.amazon.com/general/latest/gr/rande.html.
|
||||
Region string
|
||||
}
|
||||
|
||||
// MonitoredResource returns resource type and resource labels for AWSEC2Instance
|
||||
func (aws *AWSEC2Instance) MonitoredResource() (resType string, labels map[string]string) {
|
||||
labels = map[string]string{
|
||||
"aws_account": aws.AWSAccount,
|
||||
"instance_id": aws.InstanceID,
|
||||
"region": aws.Region,
|
||||
}
|
||||
return "aws_ec2_instance", labels
|
||||
}
|
||||
|
||||
// Autodetect auto detects monitored resources based on
|
||||
// the environment where the application is running.
|
||||
// It supports detection of following resource types
|
||||
// 1. gke_container:
|
||||
// 2. gce_instance:
|
||||
// 3. aws_ec2_instance:
|
||||
//
|
||||
// Returns MonitoredResInterface which implements getLabels() and getType()
|
||||
// For resource definition go to https://cloud.google.com/monitoring/api/resources
|
||||
func Autodetect() Interface {
|
||||
return func() Interface {
|
||||
var autoDetected Interface
|
||||
var awsIdentityDoc *awsIdentityDocument
|
||||
var gcpMetadata *gcpMetadata
|
||||
detectOnce.Do(func() {
|
||||
|
||||
// First attempts to retrieve AWS Identity Doc and GCP metadata.
|
||||
// It then determines the resource type
|
||||
// In GCP and AWS environment both func finishes quickly. However,
|
||||
// in an environment other than those (e.g local laptop) it
|
||||
// takes 2 seconds for GCP and 5-6 for AWS.
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(2)
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
awsIdentityDoc = retrieveAWSIdentityDocument()
|
||||
}()
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
gcpMetadata = retrieveGCPMetadata()
|
||||
}()
|
||||
|
||||
wg.Wait()
|
||||
autoDetected = detectResourceType(awsIdentityDoc, gcpMetadata)
|
||||
})
|
||||
return autoDetected
|
||||
}()
|
||||
|
||||
}
|
||||
|
||||
// createAWSEC2InstanceMonitoredResource creates a aws_ec2_instance monitored resource
|
||||
// awsIdentityDoc contains AWS EC2 specific attributes.
|
||||
func createAWSEC2InstanceMonitoredResource(awsIdentityDoc *awsIdentityDocument) *AWSEC2Instance {
|
||||
awsInstance := AWSEC2Instance{
|
||||
AWSAccount: awsIdentityDoc.accountID,
|
||||
InstanceID: awsIdentityDoc.instanceID,
|
||||
Region: fmt.Sprintf("aws:%s", awsIdentityDoc.region),
|
||||
}
|
||||
return &awsInstance
|
||||
}
|
||||
|
||||
// createGCEInstanceMonitoredResource creates a gce_instance monitored resource
|
||||
// gcpMetadata contains GCP (GKE or GCE) specific attributes.
|
||||
func createGCEInstanceMonitoredResource(gcpMetadata *gcpMetadata) *GCEInstance {
|
||||
gceInstance := GCEInstance{
|
||||
ProjectID: gcpMetadata.projectID,
|
||||
InstanceID: gcpMetadata.instanceID,
|
||||
Zone: gcpMetadata.zone,
|
||||
}
|
||||
return &gceInstance
|
||||
}
|
||||
|
||||
// createGKEContainerMonitoredResource creates a gke_container monitored resource
|
||||
// gcpMetadata contains GCP (GKE or GCE) specific attributes.
|
||||
func createGKEContainerMonitoredResource(gcpMetadata *gcpMetadata) *GKEContainer {
|
||||
gkeContainer := GKEContainer{
|
||||
ProjectID: gcpMetadata.projectID,
|
||||
InstanceID: gcpMetadata.instanceID,
|
||||
Zone: gcpMetadata.zone,
|
||||
ContainerName: gcpMetadata.containerName,
|
||||
ClusterName: gcpMetadata.clusterName,
|
||||
NamespaceID: gcpMetadata.namespaceID,
|
||||
PodID: gcpMetadata.podID,
|
||||
}
|
||||
return &gkeContainer
|
||||
}
|
||||
|
||||
// detectOnce is used to make sure GCP and AWS metadata detect function executes only once.
|
||||
var detectOnce sync.Once
|
||||
|
||||
// detectResourceType determines the resource type.
|
||||
// awsIdentityDoc contains AWS EC2 attributes. nil if it is not AWS EC2 environment
|
||||
// gcpMetadata contains GCP (GKE or GCE) specific attributes.
|
||||
func detectResourceType(awsIdentityDoc *awsIdentityDocument, gcpMetadata *gcpMetadata) Interface {
|
||||
if os.Getenv("KUBERNETES_SERVICE_HOST") != "" &&
|
||||
gcpMetadata != nil && gcpMetadata.instanceID != "" {
|
||||
return createGKEContainerMonitoredResource(gcpMetadata)
|
||||
} else if gcpMetadata != nil && gcpMetadata.instanceID != "" {
|
||||
return createGCEInstanceMonitoredResource(gcpMetadata)
|
||||
} else if awsIdentityDoc != nil {
|
||||
return createAWSEC2InstanceMonitoredResource(awsIdentityDoc)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
// Copyright 2017, OpenCensus Authors
|
||||
//
|
||||
// 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 stackdriver
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
const labelKeySizeLimit = 100
|
||||
|
||||
// sanitize returns a string that is trunacated to 100 characters if it's too
|
||||
// long, and replaces non-alphanumeric characters to underscores.
|
||||
func sanitize(s string) string {
|
||||
if len(s) == 0 {
|
||||
return s
|
||||
}
|
||||
if len(s) > labelKeySizeLimit {
|
||||
s = s[:labelKeySizeLimit]
|
||||
}
|
||||
s = strings.Map(sanitizeRune, s)
|
||||
if unicode.IsDigit(rune(s[0])) {
|
||||
s = "key_" + s
|
||||
}
|
||||
if s[0] == '_' {
|
||||
s = "key" + s
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// converts anything that is not a letter or digit to an underscore
|
||||
func sanitizeRune(r rune) rune {
|
||||
if unicode.IsLetter(r) || unicode.IsDigit(r) {
|
||||
return r
|
||||
}
|
||||
// Everything else turns into an underscore
|
||||
return '_'
|
||||
}
|
||||
+278
@@ -0,0 +1,278 @@
|
||||
// Copyright 2018, OpenCensus Authors
|
||||
//
|
||||
// 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 stackdriver contains the OpenCensus exporters for
|
||||
// Stackdriver Monitoring and Stackdriver Tracing.
|
||||
//
|
||||
// This exporter can be used to send metrics to Stackdriver Monitoring and traces
|
||||
// to Stackdriver trace.
|
||||
//
|
||||
// The package uses Application Default Credentials to authenticate by default.
|
||||
// See: https://developers.google.com/identity/protocols/application-default-credentials
|
||||
//
|
||||
// Alternatively, pass the authentication options in both the MonitoringClientOptions
|
||||
// and the TraceClientOptions fields of Options.
|
||||
//
|
||||
// Stackdriver Monitoring
|
||||
//
|
||||
// This exporter support exporting OpenCensus views to Stackdriver Monitoring.
|
||||
// Each registered view becomes a metric in Stackdriver Monitoring, with the
|
||||
// tags becoming labels.
|
||||
//
|
||||
// The aggregation function determines the metric kind: LastValue aggregations
|
||||
// generate Gauge metrics and all other aggregations generate Cumulative metrics.
|
||||
//
|
||||
// In order to be able to push your stats to Stackdriver Monitoring, you must:
|
||||
//
|
||||
// 1. Create a Cloud project: https://support.google.com/cloud/answer/6251787?hl=en
|
||||
// 2. Enable billing: https://support.google.com/cloud/answer/6288653#new-billing
|
||||
// 3. Enable the Stackdriver Monitoring API: https://console.cloud.google.com/apis/dashboard
|
||||
// 4. Make sure you have a Premium Stackdriver account: https://cloud.google.com/monitoring/accounts/tiers
|
||||
//
|
||||
// These steps enable the API but don't require that your app is hosted on Google Cloud Platform.
|
||||
//
|
||||
// Stackdriver Trace
|
||||
//
|
||||
// This exporter supports exporting Trace Spans to Stackdriver Trace. It also
|
||||
// supports the Google "Cloud Trace" propagation format header.
|
||||
package stackdriver // import "contrib.go.opencensus.io/exporter/stackdriver"
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
traceapi "cloud.google.com/go/trace/apiv2"
|
||||
"contrib.go.opencensus.io/exporter/stackdriver/monitoredresource"
|
||||
"go.opencensus.io/stats/view"
|
||||
"go.opencensus.io/trace"
|
||||
"golang.org/x/oauth2/google"
|
||||
"google.golang.org/api/option"
|
||||
monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
)
|
||||
|
||||
// Options contains options for configuring the exporter.
|
||||
type Options struct {
|
||||
// ProjectID is the identifier of the Stackdriver
|
||||
// project the user is uploading the stats data to.
|
||||
// If not set, this will default to your "Application Default Credentials".
|
||||
// For details see: https://developers.google.com/accounts/docs/application-default-credentials
|
||||
ProjectID string
|
||||
|
||||
// OnError is the hook to be called when there is
|
||||
// an error uploading the stats or tracing data.
|
||||
// If no custom hook is set, errors are logged.
|
||||
// Optional.
|
||||
OnError func(err error)
|
||||
|
||||
// MonitoringClientOptions are additional options to be passed
|
||||
// to the underlying Stackdriver Monitoring API client.
|
||||
// Optional.
|
||||
MonitoringClientOptions []option.ClientOption
|
||||
|
||||
// TraceClientOptions are additional options to be passed
|
||||
// to the underlying Stackdriver Trace API client.
|
||||
// Optional.
|
||||
TraceClientOptions []option.ClientOption
|
||||
|
||||
// BundleDelayThreshold determines the max amount of time
|
||||
// the exporter can wait before uploading view data to
|
||||
// the backend.
|
||||
// Optional.
|
||||
BundleDelayThreshold time.Duration
|
||||
|
||||
// BundleCountThreshold determines how many view data events
|
||||
// can be buffered before batch uploading them to the backend.
|
||||
// Optional.
|
||||
BundleCountThreshold int
|
||||
|
||||
// Resource sets the MonitoredResource against which all views will be
|
||||
// recorded by this exporter.
|
||||
//
|
||||
// All Stackdriver metrics created by this exporter are custom metrics,
|
||||
// so only a limited number of MonitoredResource types are supported, see:
|
||||
// https://cloud.google.com/monitoring/custom-metrics/creating-metrics#which-resource
|
||||
//
|
||||
// An important consideration when setting the Resource here is that
|
||||
// Stackdriver Monitoring only allows a single writer per
|
||||
// TimeSeries, see: https://cloud.google.com/monitoring/api/v3/metrics-details#intro-time-series
|
||||
// A TimeSeries is uniquely defined by the metric type name
|
||||
// (constructed from the view name and the MetricPrefix), the Resource field,
|
||||
// and the set of label key/value pairs (in OpenCensus terminology: tag).
|
||||
//
|
||||
// If no custom Resource is set, a default MonitoredResource
|
||||
// with type global and no resource labels will be used. If you explicitly
|
||||
// set this field, you may also want to set custom DefaultMonitoringLabels.
|
||||
//
|
||||
// Deprecated: Use MonitoredResource instead.
|
||||
Resource *monitoredrespb.MonitoredResource
|
||||
|
||||
// MonitoredResource sets the MonitoredResource against which all views will be
|
||||
// recorded by this exporter.
|
||||
//
|
||||
// All Stackdriver metrics created by this exporter are custom metrics,
|
||||
// so only a limited number of MonitoredResource types are supported, see:
|
||||
// https://cloud.google.com/monitoring/custom-metrics/creating-metrics#which-resource
|
||||
//
|
||||
// An important consideration when setting the MonitoredResource here is that
|
||||
// Stackdriver Monitoring only allows a single writer per
|
||||
// TimeSeries, see: https://cloud.google.com/monitoring/api/v3/metrics-details#intro-time-series
|
||||
// A TimeSeries is uniquely defined by the metric type name
|
||||
// (constructed from the view name and the MetricPrefix), the MonitoredResource field,
|
||||
// and the set of label key/value pairs (in OpenCensus terminology: tag).
|
||||
//
|
||||
// If no custom MonitoredResource is set AND if Resource is also not set then
|
||||
// a default MonitoredResource with type global and no resource labels will be used.
|
||||
// If you explicitly set this field, you may also want to set custom DefaultMonitoringLabels.
|
||||
//
|
||||
// This field replaces Resource field. If this is set then it will override the
|
||||
// Resource field.
|
||||
// Optional, but encouraged.
|
||||
MonitoredResource monitoredresource.Interface
|
||||
|
||||
// MetricPrefix overrides the prefix of a Stackdriver metric type names.
|
||||
// Optional. If unset defaults to "OpenCensus".
|
||||
MetricPrefix string
|
||||
|
||||
// DefaultTraceAttributes will be appended to every span that is exported to
|
||||
// Stackdriver Trace.
|
||||
DefaultTraceAttributes map[string]interface{}
|
||||
|
||||
// DefaultMonitoringLabels are labels added to every metric created by this
|
||||
// exporter in Stackdriver Monitoring.
|
||||
//
|
||||
// If unset, this defaults to a single label with key "opencensus_task" and
|
||||
// value "go-<pid>@<hostname>". This default ensures that the set of labels
|
||||
// together with the default Resource (global) are unique to this
|
||||
// process, as required by Stackdriver Monitoring.
|
||||
//
|
||||
// If you set DefaultMonitoringLabels, make sure that the Resource field
|
||||
// together with these labels is unique to the
|
||||
// current process. This is to ensure that there is only a single writer to
|
||||
// each TimeSeries in Stackdriver.
|
||||
//
|
||||
// Set this to &Labels{} (a pointer to an empty Labels) to avoid getting the
|
||||
// default "opencensus_task" label. You should only do this if you know that
|
||||
// the Resource you set uniquely identifies this Go process.
|
||||
DefaultMonitoringLabels *Labels
|
||||
|
||||
// Context allows users to provide a custom context for API calls.
|
||||
//
|
||||
// This context will be used several times: first, to create Stackdriver
|
||||
// trace and metric clients, and then every time a new batch of traces or
|
||||
// stats needs to be uploaded.
|
||||
//
|
||||
// If unset, context.Background() will be used.
|
||||
Context context.Context
|
||||
}
|
||||
|
||||
// Exporter is a stats.Exporter and trace.Exporter
|
||||
// implementation that uploads data to Stackdriver.
|
||||
type Exporter struct {
|
||||
traceExporter *traceExporter
|
||||
statsExporter *statsExporter
|
||||
}
|
||||
|
||||
// NewExporter creates a new Exporter that implements both stats.Exporter and
|
||||
// trace.Exporter.
|
||||
func NewExporter(o Options) (*Exporter, error) {
|
||||
if o.Context == nil {
|
||||
o.Context = context.Background()
|
||||
}
|
||||
if o.ProjectID == "" {
|
||||
creds, err := google.FindDefaultCredentials(o.Context, traceapi.DefaultAuthScopes()...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("stackdriver: %v", err)
|
||||
}
|
||||
if creds.ProjectID == "" {
|
||||
return nil, errors.New("stackdriver: no project found with application default credentials")
|
||||
}
|
||||
o.ProjectID = creds.ProjectID
|
||||
}
|
||||
|
||||
if o.MonitoredResource != nil {
|
||||
o.Resource = convertMonitoredResourceToPB(o.MonitoredResource)
|
||||
}
|
||||
|
||||
se, err := newStatsExporter(o, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
te, err := newTraceExporter(o)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Exporter{
|
||||
statsExporter: se,
|
||||
traceExporter: te,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ExportView exports to the Stackdriver Monitoring if view data
|
||||
// has one or more rows.
|
||||
func (e *Exporter) ExportView(vd *view.Data) {
|
||||
e.statsExporter.ExportView(vd)
|
||||
}
|
||||
|
||||
// ExportSpan exports a SpanData to Stackdriver Trace.
|
||||
func (e *Exporter) ExportSpan(sd *trace.SpanData) {
|
||||
if len(e.traceExporter.o.DefaultTraceAttributes) > 0 {
|
||||
sd = e.sdWithDefaultTraceAttributes(sd)
|
||||
}
|
||||
e.traceExporter.ExportSpan(sd)
|
||||
}
|
||||
|
||||
func (e *Exporter) sdWithDefaultTraceAttributes(sd *trace.SpanData) *trace.SpanData {
|
||||
newSD := *sd
|
||||
newSD.Attributes = make(map[string]interface{})
|
||||
for k, v := range e.traceExporter.o.DefaultTraceAttributes {
|
||||
newSD.Attributes[k] = v
|
||||
}
|
||||
for k, v := range sd.Attributes {
|
||||
newSD.Attributes[k] = v
|
||||
}
|
||||
return &newSD
|
||||
}
|
||||
|
||||
// Flush waits for exported data to be uploaded.
|
||||
//
|
||||
// This is useful if your program is ending and you do not
|
||||
// want to lose recent stats or spans.
|
||||
func (e *Exporter) Flush() {
|
||||
e.statsExporter.Flush()
|
||||
e.traceExporter.Flush()
|
||||
}
|
||||
|
||||
func (o Options) handleError(err error) {
|
||||
if o.OnError != nil {
|
||||
o.OnError(err)
|
||||
return
|
||||
}
|
||||
log.Printf("Failed to export to Stackdriver: %v", err)
|
||||
}
|
||||
|
||||
// convertMonitoredResourceToPB converts MonitoredResource data in to
|
||||
// protocol buffer.
|
||||
func convertMonitoredResourceToPB(mr monitoredresource.Interface) *monitoredrespb.MonitoredResource {
|
||||
mrpb := new(monitoredrespb.MonitoredResource)
|
||||
var labels map[string]string
|
||||
mrpb.Type, labels = mr.MonitoredResource()
|
||||
mrpb.Labels = make(map[string]string)
|
||||
for k, v := range labels {
|
||||
mrpb.Labels[k] = v
|
||||
}
|
||||
return mrpb
|
||||
}
|
||||
+471
@@ -0,0 +1,471 @@
|
||||
// Copyright 2017, OpenCensus Authors
|
||||
//
|
||||
// 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 stackdriver
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"go.opencensus.io"
|
||||
"go.opencensus.io/stats"
|
||||
"go.opencensus.io/stats/view"
|
||||
"go.opencensus.io/tag"
|
||||
"go.opencensus.io/trace"
|
||||
|
||||
"cloud.google.com/go/monitoring/apiv3"
|
||||
"github.com/golang/protobuf/ptypes/timestamp"
|
||||
"google.golang.org/api/option"
|
||||
"google.golang.org/api/support/bundler"
|
||||
distributionpb "google.golang.org/genproto/googleapis/api/distribution"
|
||||
labelpb "google.golang.org/genproto/googleapis/api/label"
|
||||
"google.golang.org/genproto/googleapis/api/metric"
|
||||
metricpb "google.golang.org/genproto/googleapis/api/metric"
|
||||
monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
)
|
||||
|
||||
const (
|
||||
maxTimeSeriesPerUpload = 200
|
||||
opencensusTaskKey = "opencensus_task"
|
||||
opencensusTaskDescription = "Opencensus task identifier"
|
||||
defaultDisplayNamePrefix = "OpenCensus"
|
||||
version = "0.6.0"
|
||||
)
|
||||
|
||||
var userAgent = fmt.Sprintf("opencensus-go %s; stackdriver-exporter %s", opencensus.Version(), version)
|
||||
|
||||
// statsExporter exports stats to the Stackdriver Monitoring.
|
||||
type statsExporter struct {
|
||||
bundler *bundler.Bundler
|
||||
o Options
|
||||
|
||||
createdViewsMu sync.Mutex
|
||||
createdViews map[string]*metricpb.MetricDescriptor // Views already created remotely
|
||||
|
||||
c *monitoring.MetricClient
|
||||
defaultLabels map[string]labelValue
|
||||
}
|
||||
|
||||
var (
|
||||
errBlankProjectID = errors.New("expecting a non-blank ProjectID")
|
||||
)
|
||||
|
||||
// newStatsExporter returns an exporter that uploads stats data to Stackdriver Monitoring.
|
||||
// Only one Stackdriver exporter should be created per ProjectID per process, any subsequent
|
||||
// invocations of NewExporter with the same ProjectID will return an error.
|
||||
func newStatsExporter(o Options, enforceProjectUniqueness bool) (*statsExporter, error) {
|
||||
if strings.TrimSpace(o.ProjectID) == "" {
|
||||
return nil, errBlankProjectID
|
||||
}
|
||||
|
||||
opts := append(o.MonitoringClientOptions, option.WithUserAgent(userAgent))
|
||||
client, err := monitoring.NewMetricClient(o.Context, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
e := &statsExporter{
|
||||
c: client,
|
||||
o: o,
|
||||
createdViews: make(map[string]*metricpb.MetricDescriptor),
|
||||
}
|
||||
if o.DefaultMonitoringLabels != nil {
|
||||
e.defaultLabels = o.DefaultMonitoringLabels.m
|
||||
} else {
|
||||
e.defaultLabels = map[string]labelValue{
|
||||
opencensusTaskKey: {val: getTaskValue(), desc: opencensusTaskDescription},
|
||||
}
|
||||
}
|
||||
e.bundler = bundler.NewBundler((*view.Data)(nil), func(bundle interface{}) {
|
||||
vds := bundle.([]*view.Data)
|
||||
e.handleUpload(vds...)
|
||||
})
|
||||
e.bundler.DelayThreshold = e.o.BundleDelayThreshold
|
||||
e.bundler.BundleCountThreshold = e.o.BundleCountThreshold
|
||||
return e, nil
|
||||
}
|
||||
|
||||
// ExportView exports to the Stackdriver Monitoring if view data
|
||||
// has one or more rows.
|
||||
func (e *statsExporter) ExportView(vd *view.Data) {
|
||||
if len(vd.Rows) == 0 {
|
||||
return
|
||||
}
|
||||
err := e.bundler.Add(vd, 1)
|
||||
switch err {
|
||||
case nil:
|
||||
return
|
||||
case bundler.ErrOversizedItem:
|
||||
go e.handleUpload(vd)
|
||||
case bundler.ErrOverflow:
|
||||
e.o.handleError(errors.New("failed to upload: buffer full"))
|
||||
default:
|
||||
e.o.handleError(err)
|
||||
}
|
||||
}
|
||||
|
||||
// getTaskValue returns a task label value in the format of
|
||||
// "go-<pid>@<hostname>".
|
||||
func getTaskValue() string {
|
||||
hostname, err := os.Hostname()
|
||||
if err != nil {
|
||||
hostname = "localhost"
|
||||
}
|
||||
return "go-" + strconv.Itoa(os.Getpid()) + "@" + hostname
|
||||
}
|
||||
|
||||
// handleUpload handles uploading a slice
|
||||
// of Data, as well as error handling.
|
||||
func (e *statsExporter) handleUpload(vds ...*view.Data) {
|
||||
if err := e.uploadStats(vds); err != nil {
|
||||
e.o.handleError(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Flush waits for exported view data to be uploaded.
|
||||
//
|
||||
// This is useful if your program is ending and you do not
|
||||
// want to lose recent spans.
|
||||
func (e *statsExporter) Flush() {
|
||||
e.bundler.Flush()
|
||||
}
|
||||
|
||||
func (e *statsExporter) uploadStats(vds []*view.Data) error {
|
||||
ctx, span := trace.StartSpan(
|
||||
e.o.Context,
|
||||
"contrib.go.opencensus.io/exporter/stackdriver.uploadStats",
|
||||
trace.WithSampler(trace.NeverSample()),
|
||||
)
|
||||
defer span.End()
|
||||
|
||||
for _, vd := range vds {
|
||||
if err := e.createMeasure(ctx, vd.View); err != nil {
|
||||
span.SetStatus(trace.Status{Code: 2, Message: err.Error()})
|
||||
return err
|
||||
}
|
||||
}
|
||||
for _, req := range e.makeReq(vds, maxTimeSeriesPerUpload) {
|
||||
if err := createTimeSeries(ctx, e.c, req); err != nil {
|
||||
span.SetStatus(trace.Status{Code: 2, Message: err.Error()})
|
||||
// TODO(jbd): Don't fail fast here, batch errors?
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *statsExporter) makeReq(vds []*view.Data, limit int) []*monitoringpb.CreateTimeSeriesRequest {
|
||||
var reqs []*monitoringpb.CreateTimeSeriesRequest
|
||||
var timeSeries []*monitoringpb.TimeSeries
|
||||
|
||||
resource := e.o.Resource
|
||||
if resource == nil {
|
||||
resource = &monitoredrespb.MonitoredResource{
|
||||
Type: "global",
|
||||
}
|
||||
}
|
||||
|
||||
for _, vd := range vds {
|
||||
for _, row := range vd.Rows {
|
||||
ts := &monitoringpb.TimeSeries{
|
||||
Metric: &metricpb.Metric{
|
||||
Type: namespacedViewName(vd.View.Name),
|
||||
Labels: newLabels(e.defaultLabels, row.Tags),
|
||||
},
|
||||
Resource: resource,
|
||||
Points: []*monitoringpb.Point{newPoint(vd.View, row, vd.Start, vd.End)},
|
||||
}
|
||||
timeSeries = append(timeSeries, ts)
|
||||
if len(timeSeries) == limit {
|
||||
reqs = append(reqs, &monitoringpb.CreateTimeSeriesRequest{
|
||||
Name: monitoring.MetricProjectPath(e.o.ProjectID),
|
||||
TimeSeries: timeSeries,
|
||||
})
|
||||
timeSeries = []*monitoringpb.TimeSeries{}
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(timeSeries) > 0 {
|
||||
reqs = append(reqs, &monitoringpb.CreateTimeSeriesRequest{
|
||||
Name: monitoring.MetricProjectPath(e.o.ProjectID),
|
||||
TimeSeries: timeSeries,
|
||||
})
|
||||
}
|
||||
return reqs
|
||||
}
|
||||
|
||||
// createMeasure creates a MetricDescriptor for the given view data in Stackdriver Monitoring.
|
||||
// An error will be returned if there is already a metric descriptor created with the same name
|
||||
// but it has a different aggregation or keys.
|
||||
func (e *statsExporter) createMeasure(ctx context.Context, v *view.View) error {
|
||||
e.createdViewsMu.Lock()
|
||||
defer e.createdViewsMu.Unlock()
|
||||
|
||||
m := v.Measure
|
||||
agg := v.Aggregation
|
||||
tagKeys := v.TagKeys
|
||||
viewName := v.Name
|
||||
|
||||
if md, ok := e.createdViews[viewName]; ok {
|
||||
return e.equalMeasureAggTagKeys(md, m, agg, tagKeys)
|
||||
}
|
||||
|
||||
metricType := namespacedViewName(viewName)
|
||||
var valueType metricpb.MetricDescriptor_ValueType
|
||||
unit := m.Unit()
|
||||
// Default metric Kind
|
||||
metricKind := metricpb.MetricDescriptor_CUMULATIVE
|
||||
|
||||
switch agg.Type {
|
||||
case view.AggTypeCount:
|
||||
valueType = metricpb.MetricDescriptor_INT64
|
||||
// If the aggregation type is count, which counts the number of recorded measurements, the unit must be "1",
|
||||
// because this view does not apply to the recorded values.
|
||||
unit = stats.UnitDimensionless
|
||||
case view.AggTypeSum:
|
||||
switch m.(type) {
|
||||
case *stats.Int64Measure:
|
||||
valueType = metricpb.MetricDescriptor_INT64
|
||||
case *stats.Float64Measure:
|
||||
valueType = metricpb.MetricDescriptor_DOUBLE
|
||||
}
|
||||
case view.AggTypeDistribution:
|
||||
valueType = metricpb.MetricDescriptor_DISTRIBUTION
|
||||
case view.AggTypeLastValue:
|
||||
metricKind = metricpb.MetricDescriptor_GAUGE
|
||||
switch m.(type) {
|
||||
case *stats.Int64Measure:
|
||||
valueType = metricpb.MetricDescriptor_INT64
|
||||
case *stats.Float64Measure:
|
||||
valueType = metricpb.MetricDescriptor_DOUBLE
|
||||
}
|
||||
default:
|
||||
return fmt.Errorf("unsupported aggregation type: %s", agg.Type.String())
|
||||
}
|
||||
|
||||
displayNamePrefix := defaultDisplayNamePrefix
|
||||
if e.o.MetricPrefix != "" {
|
||||
displayNamePrefix = e.o.MetricPrefix
|
||||
}
|
||||
|
||||
md, err := createMetricDescriptor(ctx, e.c, &monitoringpb.CreateMetricDescriptorRequest{
|
||||
Name: fmt.Sprintf("projects/%s", e.o.ProjectID),
|
||||
MetricDescriptor: &metricpb.MetricDescriptor{
|
||||
Name: fmt.Sprintf("projects/%s/metricDescriptors/%s", e.o.ProjectID, metricType),
|
||||
DisplayName: path.Join(displayNamePrefix, viewName),
|
||||
Description: v.Description,
|
||||
Unit: unit,
|
||||
Type: metricType,
|
||||
MetricKind: metricKind,
|
||||
ValueType: valueType,
|
||||
Labels: newLabelDescriptors(e.defaultLabels, v.TagKeys),
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
e.createdViews[viewName] = md
|
||||
return nil
|
||||
}
|
||||
|
||||
func newPoint(v *view.View, row *view.Row, start, end time.Time) *monitoringpb.Point {
|
||||
switch v.Aggregation.Type {
|
||||
case view.AggTypeLastValue:
|
||||
return newGaugePoint(v, row, end)
|
||||
default:
|
||||
return newCumulativePoint(v, row, start, end)
|
||||
}
|
||||
}
|
||||
|
||||
func newCumulativePoint(v *view.View, row *view.Row, start, end time.Time) *monitoringpb.Point {
|
||||
return &monitoringpb.Point{
|
||||
Interval: &monitoringpb.TimeInterval{
|
||||
StartTime: ×tamp.Timestamp{
|
||||
Seconds: start.Unix(),
|
||||
Nanos: int32(start.Nanosecond()),
|
||||
},
|
||||
EndTime: ×tamp.Timestamp{
|
||||
Seconds: end.Unix(),
|
||||
Nanos: int32(end.Nanosecond()),
|
||||
},
|
||||
},
|
||||
Value: newTypedValue(v, row),
|
||||
}
|
||||
}
|
||||
|
||||
func newGaugePoint(v *view.View, row *view.Row, end time.Time) *monitoringpb.Point {
|
||||
gaugeTime := ×tamp.Timestamp{
|
||||
Seconds: end.Unix(),
|
||||
Nanos: int32(end.Nanosecond()),
|
||||
}
|
||||
return &monitoringpb.Point{
|
||||
Interval: &monitoringpb.TimeInterval{
|
||||
EndTime: gaugeTime,
|
||||
},
|
||||
Value: newTypedValue(v, row),
|
||||
}
|
||||
}
|
||||
|
||||
func newTypedValue(vd *view.View, r *view.Row) *monitoringpb.TypedValue {
|
||||
switch v := r.Data.(type) {
|
||||
case *view.CountData:
|
||||
return &monitoringpb.TypedValue{Value: &monitoringpb.TypedValue_Int64Value{
|
||||
Int64Value: v.Value,
|
||||
}}
|
||||
case *view.SumData:
|
||||
switch vd.Measure.(type) {
|
||||
case *stats.Int64Measure:
|
||||
return &monitoringpb.TypedValue{Value: &monitoringpb.TypedValue_Int64Value{
|
||||
Int64Value: int64(v.Value),
|
||||
}}
|
||||
case *stats.Float64Measure:
|
||||
return &monitoringpb.TypedValue{Value: &monitoringpb.TypedValue_DoubleValue{
|
||||
DoubleValue: v.Value,
|
||||
}}
|
||||
}
|
||||
case *view.DistributionData:
|
||||
return &monitoringpb.TypedValue{Value: &monitoringpb.TypedValue_DistributionValue{
|
||||
DistributionValue: &distributionpb.Distribution{
|
||||
Count: v.Count,
|
||||
Mean: v.Mean,
|
||||
SumOfSquaredDeviation: v.SumOfSquaredDev,
|
||||
// TODO(songya): uncomment this once Stackdriver supports min/max.
|
||||
// Range: &distributionpb.Distribution_Range{
|
||||
// Min: v.Min,
|
||||
// Max: v.Max,
|
||||
// },
|
||||
BucketOptions: &distributionpb.Distribution_BucketOptions{
|
||||
Options: &distributionpb.Distribution_BucketOptions_ExplicitBuckets{
|
||||
ExplicitBuckets: &distributionpb.Distribution_BucketOptions_Explicit{
|
||||
Bounds: vd.Aggregation.Buckets,
|
||||
},
|
||||
},
|
||||
},
|
||||
BucketCounts: v.CountPerBucket,
|
||||
},
|
||||
}}
|
||||
case *view.LastValueData:
|
||||
switch vd.Measure.(type) {
|
||||
case *stats.Int64Measure:
|
||||
return &monitoringpb.TypedValue{Value: &monitoringpb.TypedValue_Int64Value{
|
||||
Int64Value: int64(v.Value),
|
||||
}}
|
||||
case *stats.Float64Measure:
|
||||
return &monitoringpb.TypedValue{Value: &monitoringpb.TypedValue_DoubleValue{
|
||||
DoubleValue: v.Value,
|
||||
}}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func namespacedViewName(v string) string {
|
||||
return path.Join("custom.googleapis.com", "opencensus", v)
|
||||
}
|
||||
|
||||
func newLabels(defaults map[string]labelValue, tags []tag.Tag) map[string]string {
|
||||
labels := make(map[string]string)
|
||||
for k, lbl := range defaults {
|
||||
labels[sanitize(k)] = lbl.val
|
||||
}
|
||||
for _, tag := range tags {
|
||||
labels[sanitize(tag.Key.Name())] = tag.Value
|
||||
}
|
||||
return labels
|
||||
}
|
||||
|
||||
func newLabelDescriptors(defaults map[string]labelValue, keys []tag.Key) []*labelpb.LabelDescriptor {
|
||||
labelDescriptors := make([]*labelpb.LabelDescriptor, 0, len(keys)+len(defaults))
|
||||
for key, lbl := range defaults {
|
||||
labelDescriptors = append(labelDescriptors, &labelpb.LabelDescriptor{
|
||||
Key: sanitize(key),
|
||||
Description: lbl.desc,
|
||||
ValueType: labelpb.LabelDescriptor_STRING,
|
||||
})
|
||||
}
|
||||
for _, key := range keys {
|
||||
labelDescriptors = append(labelDescriptors, &labelpb.LabelDescriptor{
|
||||
Key: sanitize(key.Name()),
|
||||
ValueType: labelpb.LabelDescriptor_STRING, // We only use string tags
|
||||
})
|
||||
}
|
||||
return labelDescriptors
|
||||
}
|
||||
|
||||
func (e *statsExporter) equalMeasureAggTagKeys(md *metricpb.MetricDescriptor, m stats.Measure, agg *view.Aggregation, keys []tag.Key) error {
|
||||
var aggTypeMatch bool
|
||||
switch md.ValueType {
|
||||
case metricpb.MetricDescriptor_INT64:
|
||||
if _, ok := m.(*stats.Int64Measure); !(ok || agg.Type == view.AggTypeCount) {
|
||||
return fmt.Errorf("stackdriver metric descriptor was not created as int64")
|
||||
}
|
||||
aggTypeMatch = agg.Type == view.AggTypeCount || agg.Type == view.AggTypeSum || agg.Type == view.AggTypeLastValue
|
||||
case metricpb.MetricDescriptor_DOUBLE:
|
||||
if _, ok := m.(*stats.Float64Measure); !ok {
|
||||
return fmt.Errorf("stackdriver metric descriptor was not created as double")
|
||||
}
|
||||
aggTypeMatch = agg.Type == view.AggTypeSum || agg.Type == view.AggTypeLastValue
|
||||
case metricpb.MetricDescriptor_DISTRIBUTION:
|
||||
aggTypeMatch = agg.Type == view.AggTypeDistribution
|
||||
}
|
||||
|
||||
if !aggTypeMatch {
|
||||
return fmt.Errorf("stackdriver metric descriptor was not created with aggregation type %T", agg.Type)
|
||||
}
|
||||
|
||||
labels := make(map[string]struct{}, len(keys)+len(e.defaultLabels))
|
||||
for _, k := range keys {
|
||||
labels[sanitize(k.Name())] = struct{}{}
|
||||
}
|
||||
for k := range e.defaultLabels {
|
||||
labels[sanitize(k)] = struct{}{}
|
||||
}
|
||||
|
||||
for _, k := range md.Labels {
|
||||
if _, ok := labels[k.Key]; !ok {
|
||||
return fmt.Errorf("stackdriver metric descriptor %q was not created with label %q", md.Type, k)
|
||||
}
|
||||
delete(labels, k.Key)
|
||||
}
|
||||
|
||||
if len(labels) > 0 {
|
||||
extra := make([]string, 0, len(labels))
|
||||
for k := range labels {
|
||||
extra = append(extra, k)
|
||||
}
|
||||
return fmt.Errorf("stackdriver metric descriptor %q contains unexpected labels: %s", md.Type, strings.Join(extra, ", "))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var createMetricDescriptor = func(ctx context.Context, c *monitoring.MetricClient, mdr *monitoringpb.CreateMetricDescriptorRequest) (*metric.MetricDescriptor, error) {
|
||||
return c.CreateMetricDescriptor(ctx, mdr)
|
||||
}
|
||||
|
||||
var getMetricDescriptor = func(ctx context.Context, c *monitoring.MetricClient, mdr *monitoringpb.GetMetricDescriptorRequest) (*metric.MetricDescriptor, error) {
|
||||
return c.GetMetricDescriptor(ctx, mdr)
|
||||
}
|
||||
|
||||
var createTimeSeries = func(ctx context.Context, c *monitoring.MetricClient, ts *monitoringpb.CreateTimeSeriesRequest) error {
|
||||
return c.CreateTimeSeries(ctx, ts)
|
||||
}
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
// Copyright 2017, OpenCensus Authors
|
||||
//
|
||||
// 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 stackdriver
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
tracingclient "cloud.google.com/go/trace/apiv2"
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/api/support/bundler"
|
||||
tracepb "google.golang.org/genproto/googleapis/devtools/cloudtrace/v2"
|
||||
)
|
||||
|
||||
// traceExporter is an implementation of trace.Exporter that uploads spans to
|
||||
// Stackdriver.
|
||||
//
|
||||
type traceExporter struct {
|
||||
o Options
|
||||
projectID string
|
||||
bundler *bundler.Bundler
|
||||
// uploadFn defaults to uploadSpans; it can be replaced for tests.
|
||||
uploadFn func(spans []*trace.SpanData)
|
||||
overflowLogger
|
||||
client *tracingclient.Client
|
||||
}
|
||||
|
||||
var _ trace.Exporter = (*traceExporter)(nil)
|
||||
|
||||
func newTraceExporter(o Options) (*traceExporter, error) {
|
||||
client, err := tracingclient.NewClient(o.Context, o.TraceClientOptions...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("stackdriver: couldn't initialize trace client: %v", err)
|
||||
}
|
||||
return newTraceExporterWithClient(o, client), nil
|
||||
}
|
||||
|
||||
func newTraceExporterWithClient(o Options, c *tracingclient.Client) *traceExporter {
|
||||
e := &traceExporter{
|
||||
projectID: o.ProjectID,
|
||||
client: c,
|
||||
o: o,
|
||||
}
|
||||
bundler := bundler.NewBundler((*trace.SpanData)(nil), func(bundle interface{}) {
|
||||
e.uploadFn(bundle.([]*trace.SpanData))
|
||||
})
|
||||
if o.BundleDelayThreshold > 0 {
|
||||
bundler.DelayThreshold = o.BundleDelayThreshold
|
||||
} else {
|
||||
bundler.DelayThreshold = 2 * time.Second
|
||||
}
|
||||
if o.BundleCountThreshold > 0 {
|
||||
bundler.BundleCountThreshold = o.BundleCountThreshold
|
||||
} else {
|
||||
bundler.BundleCountThreshold = 50
|
||||
}
|
||||
// The measured "bytes" are not really bytes, see exportReceiver.
|
||||
bundler.BundleByteThreshold = bundler.BundleCountThreshold * 200
|
||||
bundler.BundleByteLimit = bundler.BundleCountThreshold * 1000
|
||||
bundler.BufferedByteLimit = bundler.BundleCountThreshold * 2000
|
||||
|
||||
e.bundler = bundler
|
||||
e.uploadFn = e.uploadSpans
|
||||
return e
|
||||
}
|
||||
|
||||
// ExportSpan exports a SpanData to Stackdriver Trace.
|
||||
func (e *traceExporter) ExportSpan(s *trace.SpanData) {
|
||||
// n is a length heuristic.
|
||||
n := 1
|
||||
n += len(s.Attributes)
|
||||
n += len(s.Annotations)
|
||||
n += len(s.MessageEvents)
|
||||
err := e.bundler.Add(s, n)
|
||||
switch err {
|
||||
case nil:
|
||||
return
|
||||
case bundler.ErrOversizedItem:
|
||||
go e.uploadFn([]*trace.SpanData{s})
|
||||
case bundler.ErrOverflow:
|
||||
e.overflowLogger.log()
|
||||
default:
|
||||
e.o.handleError(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Flush waits for exported trace spans to be uploaded.
|
||||
//
|
||||
// This is useful if your program is ending and you do not want to lose recent
|
||||
// spans.
|
||||
func (e *traceExporter) Flush() {
|
||||
e.bundler.Flush()
|
||||
}
|
||||
|
||||
// uploadSpans uploads a set of spans to Stackdriver.
|
||||
func (e *traceExporter) uploadSpans(spans []*trace.SpanData) {
|
||||
req := tracepb.BatchWriteSpansRequest{
|
||||
Name: "projects/" + e.projectID,
|
||||
Spans: make([]*tracepb.Span, 0, len(spans)),
|
||||
}
|
||||
for _, span := range spans {
|
||||
req.Spans = append(req.Spans, protoFromSpanData(span, e.projectID, e.o.Resource))
|
||||
}
|
||||
// Create a never-sampled span to prevent traces associated with exporter.
|
||||
ctx, span := trace.StartSpan( // TODO: add timeouts
|
||||
e.o.Context,
|
||||
"contrib.go.opencensus.io/exporter/stackdriver.uploadSpans",
|
||||
trace.WithSampler(trace.NeverSample()),
|
||||
)
|
||||
defer span.End()
|
||||
span.AddAttributes(trace.Int64Attribute("num_spans", int64(len(spans))))
|
||||
|
||||
err := e.client.BatchWriteSpans(ctx, &req)
|
||||
if err != nil {
|
||||
span.SetStatus(trace.Status{Code: 2, Message: err.Error()})
|
||||
e.o.handleError(err)
|
||||
}
|
||||
}
|
||||
|
||||
// overflowLogger ensures that at most one overflow error log message is
|
||||
// written every 5 seconds.
|
||||
type overflowLogger struct {
|
||||
mu sync.Mutex
|
||||
pause bool
|
||||
accum int
|
||||
}
|
||||
|
||||
func (o *overflowLogger) delay() {
|
||||
o.pause = true
|
||||
time.AfterFunc(5*time.Second, func() {
|
||||
o.mu.Lock()
|
||||
defer o.mu.Unlock()
|
||||
switch {
|
||||
case o.accum == 0:
|
||||
o.pause = false
|
||||
case o.accum == 1:
|
||||
log.Println("OpenCensus Stackdriver exporter: failed to upload span: buffer full")
|
||||
o.accum = 0
|
||||
o.delay()
|
||||
default:
|
||||
log.Printf("OpenCensus Stackdriver exporter: failed to upload %d spans: buffer full", o.accum)
|
||||
o.accum = 0
|
||||
o.delay()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (o *overflowLogger) log() {
|
||||
o.mu.Lock()
|
||||
defer o.mu.Unlock()
|
||||
if !o.pause {
|
||||
log.Println("OpenCensus Stackdriver exporter: failed to upload span: buffer full")
|
||||
o.delay()
|
||||
} else {
|
||||
o.accum++
|
||||
}
|
||||
}
|
||||
+277
@@ -0,0 +1,277 @@
|
||||
// Copyright 2017, OpenCensus Authors
|
||||
//
|
||||
// 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 stackdriver
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
timestamppb "github.com/golang/protobuf/ptypes/timestamp"
|
||||
wrapperspb "github.com/golang/protobuf/ptypes/wrappers"
|
||||
"go.opencensus.io/plugin/ochttp"
|
||||
"go.opencensus.io/trace"
|
||||
monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
tracepb "google.golang.org/genproto/googleapis/devtools/cloudtrace/v2"
|
||||
statuspb "google.golang.org/genproto/googleapis/rpc/status"
|
||||
)
|
||||
|
||||
const (
|
||||
maxAnnotationEventsPerSpan = 32
|
||||
maxMessageEventsPerSpan = 128
|
||||
maxAttributeStringValue = 256
|
||||
agentLabel = "g.co/agent"
|
||||
|
||||
labelHTTPHost = `/http/host`
|
||||
labelHTTPMethod = `/http/method`
|
||||
labelHTTPStatusCode = `/http/status_code`
|
||||
labelHTTPPath = `/http/path`
|
||||
labelHTTPUserAgent = `/http/user_agent`
|
||||
)
|
||||
|
||||
// proto returns a protocol buffer representation of a SpanData.
|
||||
func protoFromSpanData(s *trace.SpanData, projectID string, mr *monitoredrespb.MonitoredResource) *tracepb.Span {
|
||||
if s == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
traceIDString := s.SpanContext.TraceID.String()
|
||||
spanIDString := s.SpanContext.SpanID.String()
|
||||
|
||||
name := s.Name
|
||||
switch s.SpanKind {
|
||||
case trace.SpanKindClient:
|
||||
name = "Sent." + name
|
||||
case trace.SpanKindServer:
|
||||
name = "Recv." + name
|
||||
}
|
||||
|
||||
sp := &tracepb.Span{
|
||||
Name: "projects/" + projectID + "/traces/" + traceIDString + "/spans/" + spanIDString,
|
||||
SpanId: spanIDString,
|
||||
DisplayName: trunc(name, 128),
|
||||
StartTime: timestampProto(s.StartTime),
|
||||
EndTime: timestampProto(s.EndTime),
|
||||
SameProcessAsParentSpan: &wrapperspb.BoolValue{Value: !s.HasRemoteParent},
|
||||
}
|
||||
if p := s.ParentSpanID; p != (trace.SpanID{}) {
|
||||
sp.ParentSpanId = p.String()
|
||||
}
|
||||
if s.Status.Code != 0 || s.Status.Message != "" {
|
||||
sp.Status = &statuspb.Status{Code: s.Status.Code, Message: s.Status.Message}
|
||||
}
|
||||
|
||||
var annotations, droppedAnnotationsCount, messageEvents, droppedMessageEventsCount int
|
||||
copyAttributes(&sp.Attributes, s.Attributes)
|
||||
|
||||
// Copy MonitoredResources as span Attributes
|
||||
sp.Attributes = copyMonitoredResourceAttributes(sp.Attributes, mr)
|
||||
|
||||
as := s.Annotations
|
||||
for i, a := range as {
|
||||
if annotations >= maxAnnotationEventsPerSpan {
|
||||
droppedAnnotationsCount = len(as) - i
|
||||
break
|
||||
}
|
||||
annotation := &tracepb.Span_TimeEvent_Annotation{Description: trunc(a.Message, maxAttributeStringValue)}
|
||||
copyAttributes(&annotation.Attributes, a.Attributes)
|
||||
event := &tracepb.Span_TimeEvent{
|
||||
Time: timestampProto(a.Time),
|
||||
Value: &tracepb.Span_TimeEvent_Annotation_{Annotation: annotation},
|
||||
}
|
||||
annotations++
|
||||
if sp.TimeEvents == nil {
|
||||
sp.TimeEvents = &tracepb.Span_TimeEvents{}
|
||||
}
|
||||
sp.TimeEvents.TimeEvent = append(sp.TimeEvents.TimeEvent, event)
|
||||
}
|
||||
|
||||
if sp.Attributes == nil {
|
||||
sp.Attributes = &tracepb.Span_Attributes{
|
||||
AttributeMap: make(map[string]*tracepb.AttributeValue),
|
||||
}
|
||||
}
|
||||
sp.Attributes.AttributeMap[agentLabel] = &tracepb.AttributeValue{
|
||||
Value: &tracepb.AttributeValue_StringValue{
|
||||
StringValue: trunc(userAgent, maxAttributeStringValue),
|
||||
},
|
||||
}
|
||||
|
||||
es := s.MessageEvents
|
||||
for i, e := range es {
|
||||
if messageEvents >= maxMessageEventsPerSpan {
|
||||
droppedMessageEventsCount = len(es) - i
|
||||
break
|
||||
}
|
||||
messageEvents++
|
||||
if sp.TimeEvents == nil {
|
||||
sp.TimeEvents = &tracepb.Span_TimeEvents{}
|
||||
}
|
||||
sp.TimeEvents.TimeEvent = append(sp.TimeEvents.TimeEvent, &tracepb.Span_TimeEvent{
|
||||
Time: timestampProto(e.Time),
|
||||
Value: &tracepb.Span_TimeEvent_MessageEvent_{
|
||||
MessageEvent: &tracepb.Span_TimeEvent_MessageEvent{
|
||||
Type: tracepb.Span_TimeEvent_MessageEvent_Type(e.EventType),
|
||||
Id: e.MessageID,
|
||||
UncompressedSizeBytes: e.UncompressedByteSize,
|
||||
CompressedSizeBytes: e.CompressedByteSize,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
if droppedAnnotationsCount != 0 || droppedMessageEventsCount != 0 {
|
||||
if sp.TimeEvents == nil {
|
||||
sp.TimeEvents = &tracepb.Span_TimeEvents{}
|
||||
}
|
||||
sp.TimeEvents.DroppedAnnotationsCount = clip32(droppedAnnotationsCount)
|
||||
sp.TimeEvents.DroppedMessageEventsCount = clip32(droppedMessageEventsCount)
|
||||
}
|
||||
|
||||
if len(s.Links) > 0 {
|
||||
sp.Links = &tracepb.Span_Links{}
|
||||
sp.Links.Link = make([]*tracepb.Span_Link, 0, len(s.Links))
|
||||
for _, l := range s.Links {
|
||||
link := &tracepb.Span_Link{
|
||||
TraceId: l.TraceID.String(),
|
||||
SpanId: l.SpanID.String(),
|
||||
Type: tracepb.Span_Link_Type(l.Type),
|
||||
}
|
||||
copyAttributes(&link.Attributes, l.Attributes)
|
||||
sp.Links.Link = append(sp.Links.Link, link)
|
||||
}
|
||||
}
|
||||
return sp
|
||||
}
|
||||
|
||||
// timestampProto creates a timestamp proto for a time.Time.
|
||||
func timestampProto(t time.Time) *timestamppb.Timestamp {
|
||||
return ×tamppb.Timestamp{
|
||||
Seconds: t.Unix(),
|
||||
Nanos: int32(t.Nanosecond()),
|
||||
}
|
||||
}
|
||||
|
||||
// copyMonitoredResourceAttributes copies proto monitoredResource to proto map field (Span_Attributes)
|
||||
// it creates the map if it is nil.
|
||||
func copyMonitoredResourceAttributes(out *tracepb.Span_Attributes, mr *monitoredrespb.MonitoredResource) *tracepb.Span_Attributes {
|
||||
if mr == nil {
|
||||
return out
|
||||
}
|
||||
if out == nil {
|
||||
out = &tracepb.Span_Attributes{}
|
||||
}
|
||||
if out.AttributeMap == nil {
|
||||
out.AttributeMap = make(map[string]*tracepb.AttributeValue)
|
||||
}
|
||||
for k, v := range mr.Labels {
|
||||
av := attributeValue(v)
|
||||
out.AttributeMap[fmt.Sprintf("g.co/r/%s/%s", mr.Type, k)] = av
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// copyAttributes copies a map of attributes to a proto map field.
|
||||
// It creates the map if it is nil.
|
||||
func copyAttributes(out **tracepb.Span_Attributes, in map[string]interface{}) {
|
||||
if len(in) == 0 {
|
||||
return
|
||||
}
|
||||
if *out == nil {
|
||||
*out = &tracepb.Span_Attributes{}
|
||||
}
|
||||
if (*out).AttributeMap == nil {
|
||||
(*out).AttributeMap = make(map[string]*tracepb.AttributeValue)
|
||||
}
|
||||
var dropped int32
|
||||
for key, value := range in {
|
||||
av := attributeValue(value)
|
||||
if av == nil {
|
||||
continue
|
||||
}
|
||||
switch key {
|
||||
case ochttp.PathAttribute:
|
||||
(*out).AttributeMap[labelHTTPPath] = av
|
||||
case ochttp.HostAttribute:
|
||||
(*out).AttributeMap[labelHTTPHost] = av
|
||||
case ochttp.MethodAttribute:
|
||||
(*out).AttributeMap[labelHTTPMethod] = av
|
||||
case ochttp.UserAgentAttribute:
|
||||
(*out).AttributeMap[labelHTTPUserAgent] = av
|
||||
case ochttp.StatusCodeAttribute:
|
||||
(*out).AttributeMap[labelHTTPStatusCode] = av
|
||||
default:
|
||||
if len(key) > 128 {
|
||||
dropped++
|
||||
continue
|
||||
}
|
||||
(*out).AttributeMap[key] = av
|
||||
}
|
||||
}
|
||||
(*out).DroppedAttributesCount = dropped
|
||||
}
|
||||
|
||||
func attributeValue(v interface{}) *tracepb.AttributeValue {
|
||||
switch value := v.(type) {
|
||||
case bool:
|
||||
return &tracepb.AttributeValue{
|
||||
Value: &tracepb.AttributeValue_BoolValue{BoolValue: value},
|
||||
}
|
||||
case int64:
|
||||
return &tracepb.AttributeValue{
|
||||
Value: &tracepb.AttributeValue_IntValue{IntValue: value},
|
||||
}
|
||||
case string:
|
||||
return &tracepb.AttributeValue{
|
||||
Value: &tracepb.AttributeValue_StringValue{StringValue: trunc(value, maxAttributeStringValue)},
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// trunc returns a TruncatableString truncated to the given limit.
|
||||
func trunc(s string, limit int) *tracepb.TruncatableString {
|
||||
if len(s) > limit {
|
||||
b := []byte(s[:limit])
|
||||
for {
|
||||
r, size := utf8.DecodeLastRune(b)
|
||||
if r == utf8.RuneError && size == 1 {
|
||||
b = b[:len(b)-1]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
return &tracepb.TruncatableString{
|
||||
Value: string(b),
|
||||
TruncatedByteCount: clip32(len(s) - len(b)),
|
||||
}
|
||||
}
|
||||
return &tracepb.TruncatableString{
|
||||
Value: s,
|
||||
TruncatedByteCount: 0,
|
||||
}
|
||||
}
|
||||
|
||||
// clip32 clips an int to the range of an int32.
|
||||
func clip32(x int) int32 {
|
||||
if x < math.MinInt32 {
|
||||
return math.MinInt32
|
||||
}
|
||||
if x > math.MaxInt32 {
|
||||
return math.MaxInt32
|
||||
}
|
||||
return int32(x)
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/protobuf/empty.proto
|
||||
|
||||
package empty // import "github.com/golang/protobuf/ptypes/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 {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Empty) Reset() { *m = Empty{} }
|
||||
func (m *Empty) String() string { return proto.CompactTextString(m) }
|
||||
func (*Empty) ProtoMessage() {}
|
||||
func (*Empty) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_empty_39e6d6db0632e5b2, []int{0}
|
||||
}
|
||||
func (*Empty) XXX_WellKnownType() string { return "Empty" }
|
||||
func (m *Empty) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Empty.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Empty.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Empty) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Empty.Merge(dst, src)
|
||||
}
|
||||
func (m *Empty) XXX_Size() int {
|
||||
return xxx_messageInfo_Empty.Size(m)
|
||||
}
|
||||
func (m *Empty) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Empty.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Empty proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Empty)(nil), "google.protobuf.Empty")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("google/protobuf/empty.proto", fileDescriptor_empty_39e6d6db0632e5b2) }
|
||||
|
||||
var fileDescriptor_empty_39e6d6db0632e5b2 = []byte{
|
||||
// 148 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcd, 0x2d, 0x28,
|
||||
0xa9, 0xd4, 0x03, 0x73, 0x85, 0xf8, 0x21, 0x92, 0x7a, 0x30, 0x49, 0x25, 0x76, 0x2e, 0x56, 0x57,
|
||||
0x90, 0xbc, 0x53, 0x19, 0x97, 0x70, 0x72, 0x7e, 0xae, 0x1e, 0x9a, 0xbc, 0x13, 0x17, 0x58, 0x36,
|
||||
0x00, 0xc4, 0x0d, 0x60, 0x8c, 0x52, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf,
|
||||
0xd5, 0x4f, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0x47, 0x58, 0x53, 0x50, 0x52, 0x59, 0x90, 0x5a, 0x0c,
|
||||
0xb1, 0xed, 0x07, 0x23, 0xe3, 0x22, 0x26, 0x66, 0xf7, 0x00, 0xa7, 0x55, 0x4c, 0x72, 0xee, 0x10,
|
||||
0x13, 0x03, 0xa0, 0xea, 0xf4, 0xc2, 0x53, 0x73, 0x72, 0xbc, 0xf3, 0xf2, 0xcb, 0xf3, 0x42, 0x40,
|
||||
0xea, 0x93, 0xd8, 0xc0, 0x06, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x64, 0xd4, 0xb3, 0xa6,
|
||||
0xb7, 0x00, 0x00, 0x00,
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
// 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 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 {}
|
||||
+450
@@ -0,0 +1,450 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/protobuf/struct.proto
|
||||
|
||||
package structpb // import "github.com/golang/protobuf/ptypes/struct"
|
||||
|
||||
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 fileDescriptor_struct_3a5a94e0c7801b27, []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,proto3" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Struct) Reset() { *m = Struct{} }
|
||||
func (m *Struct) String() string { return proto.CompactTextString(m) }
|
||||
func (*Struct) ProtoMessage() {}
|
||||
func (*Struct) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_struct_3a5a94e0c7801b27, []int{0}
|
||||
}
|
||||
func (*Struct) XXX_WellKnownType() string { return "Struct" }
|
||||
func (m *Struct) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Struct.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Struct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Struct.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Struct) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Struct.Merge(dst, src)
|
||||
}
|
||||
func (m *Struct) XXX_Size() int {
|
||||
return xxx_messageInfo_Struct.Size(m)
|
||||
}
|
||||
func (m *Struct) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Struct.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Struct proto.InternalMessageInfo
|
||||
|
||||
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"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Value) Reset() { *m = Value{} }
|
||||
func (m *Value) String() string { return proto.CompactTextString(m) }
|
||||
func (*Value) ProtoMessage() {}
|
||||
func (*Value) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_struct_3a5a94e0c7801b27, []int{1}
|
||||
}
|
||||
func (*Value) XXX_WellKnownType() string { return "Value" }
|
||||
func (m *Value) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Value.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Value.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Value) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Value.Merge(dst, src)
|
||||
}
|
||||
func (m *Value) XXX_Size() int {
|
||||
return xxx_messageInfo_Value.Size(m)
|
||||
}
|
||||
func (m *Value) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Value.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Value proto.InternalMessageInfo
|
||||
|
||||
type isValue_Kind interface {
|
||||
isValue_Kind()
|
||||
}
|
||||
|
||||
type Value_NullValue struct {
|
||||
NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"`
|
||||
}
|
||||
|
||||
type Value_NumberValue struct {
|
||||
NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Value_StringValue struct {
|
||||
StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Value_BoolValue struct {
|
||||
BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Value_StructValue struct {
|
||||
StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Value_ListValue struct {
|
||||
ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,proto3,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 += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(x.NullValue))
|
||||
case *Value_NumberValue:
|
||||
n += 1 // tag and wire
|
||||
n += 8
|
||||
case *Value_StringValue:
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(len(x.StringValue)))
|
||||
n += len(x.StringValue)
|
||||
case *Value_BoolValue:
|
||||
n += 1 // tag and wire
|
||||
n += 1
|
||||
case *Value_StructValue:
|
||||
s := proto.Size(x.StructValue)
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *Value_ListValue:
|
||||
s := proto.Size(x.ListValue)
|
||||
n += 1 // tag and wire
|
||||
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,proto3" json:"values,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListValue) Reset() { *m = ListValue{} }
|
||||
func (m *ListValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListValue) ProtoMessage() {}
|
||||
func (*ListValue) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_struct_3a5a94e0c7801b27, []int{2}
|
||||
}
|
||||
func (*ListValue) XXX_WellKnownType() string { return "ListValue" }
|
||||
func (m *ListValue) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListValue.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListValue.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ListValue) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListValue.Merge(dst, src)
|
||||
}
|
||||
func (m *ListValue) XXX_Size() int {
|
||||
return xxx_messageInfo_ListValue.Size(m)
|
||||
}
|
||||
func (m *ListValue) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListValue.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListValue proto.InternalMessageInfo
|
||||
|
||||
func (m *ListValue) GetValues() []*Value {
|
||||
if m != nil {
|
||||
return m.Values
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Struct)(nil), "google.protobuf.Struct")
|
||||
proto.RegisterMapType((map[string]*Value)(nil), "google.protobuf.Struct.FieldsEntry")
|
||||
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("google/protobuf/struct.proto", fileDescriptor_struct_3a5a94e0c7801b27)
|
||||
}
|
||||
|
||||
var fileDescriptor_struct_3a5a94e0c7801b27 = []byte{
|
||||
// 417 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0x8b, 0xd3, 0x40,
|
||||
0x14, 0xc7, 0x3b, 0xc9, 0x36, 0x98, 0x17, 0x59, 0x97, 0x11, 0xb4, 0xac, 0xa2, 0xa1, 0x7b, 0x09,
|
||||
0x22, 0x29, 0xd6, 0x8b, 0x18, 0x2f, 0x06, 0xd6, 0x5d, 0x30, 0x2c, 0x31, 0xba, 0x15, 0xbc, 0x94,
|
||||
0x26, 0x4d, 0x63, 0xe8, 0x74, 0x26, 0x24, 0x33, 0x4a, 0x8f, 0x7e, 0x0b, 0xcf, 0x1e, 0x3d, 0xfa,
|
||||
0xe9, 0x3c, 0xca, 0xcc, 0x24, 0xa9, 0xb4, 0xf4, 0x94, 0xbc, 0xf7, 0x7e, 0xef, 0x3f, 0xef, 0xff,
|
||||
0x66, 0xe0, 0x71, 0xc1, 0x58, 0x41, 0xf2, 0x49, 0x55, 0x33, 0xce, 0x52, 0xb1, 0x9a, 0x34, 0xbc,
|
||||
0x16, 0x19, 0xf7, 0x55, 0x8c, 0xef, 0xe9, 0xaa, 0xdf, 0x55, 0xc7, 0x3f, 0x11, 0x58, 0x1f, 0x15,
|
||||
0x81, 0x03, 0xb0, 0x56, 0x65, 0x4e, 0x96, 0xcd, 0x08, 0xb9, 0xa6, 0xe7, 0x4c, 0x2f, 0xfc, 0x3d,
|
||||
0xd8, 0xd7, 0xa0, 0xff, 0x4e, 0x51, 0x97, 0x94, 0xd7, 0xdb, 0xa4, 0x6d, 0x39, 0xff, 0x00, 0xce,
|
||||
0x7f, 0x69, 0x7c, 0x06, 0xe6, 0x3a, 0xdf, 0x8e, 0x90, 0x8b, 0x3c, 0x3b, 0x91, 0xbf, 0xf8, 0x39,
|
||||
0x0c, 0xbf, 0x2d, 0x88, 0xc8, 0x47, 0x86, 0x8b, 0x3c, 0x67, 0xfa, 0xe0, 0x40, 0x7c, 0x26, 0xab,
|
||||
0x89, 0x86, 0x5e, 0x1b, 0xaf, 0xd0, 0xf8, 0x8f, 0x01, 0x43, 0x95, 0xc4, 0x01, 0x00, 0x15, 0x84,
|
||||
0xcc, 0xb5, 0x80, 0x14, 0x3d, 0x9d, 0x9e, 0x1f, 0x08, 0xdc, 0x08, 0x42, 0x14, 0x7f, 0x3d, 0x48,
|
||||
0x6c, 0xda, 0x05, 0xf8, 0x02, 0xee, 0x52, 0xb1, 0x49, 0xf3, 0x7a, 0xbe, 0x3b, 0x1f, 0x5d, 0x0f,
|
||||
0x12, 0x47, 0x67, 0x7b, 0xa8, 0xe1, 0x75, 0x49, 0x8b, 0x16, 0x32, 0xe5, 0xe0, 0x12, 0xd2, 0x59,
|
||||
0x0d, 0x3d, 0x05, 0x48, 0x19, 0xeb, 0xc6, 0x38, 0x71, 0x91, 0x77, 0x47, 0x1e, 0x25, 0x73, 0x1a,
|
||||
0x78, 0xa3, 0x54, 0x44, 0xc6, 0x5b, 0x64, 0xa8, 0xac, 0x3e, 0x3c, 0xb2, 0xc7, 0x56, 0x5e, 0x64,
|
||||
0xbc, 0x77, 0x49, 0xca, 0xa6, 0xeb, 0xb5, 0x54, 0xef, 0xa1, 0xcb, 0xa8, 0x6c, 0x78, 0xef, 0x92,
|
||||
0x74, 0x41, 0x68, 0xc1, 0xc9, 0xba, 0xa4, 0xcb, 0x71, 0x00, 0x76, 0x4f, 0x60, 0x1f, 0x2c, 0x25,
|
||||
0xd6, 0xdd, 0xe8, 0xb1, 0xa5, 0xb7, 0xd4, 0xb3, 0x47, 0x60, 0xf7, 0x4b, 0xc4, 0xa7, 0x00, 0x37,
|
||||
0xb7, 0x51, 0x34, 0x9f, 0xbd, 0x8d, 0x6e, 0x2f, 0xcf, 0x06, 0xe1, 0x0f, 0x04, 0xf7, 0x33, 0xb6,
|
||||
0xd9, 0x97, 0x08, 0x1d, 0xed, 0x26, 0x96, 0x71, 0x8c, 0xbe, 0xbc, 0x28, 0x4a, 0xfe, 0x55, 0xa4,
|
||||
0x7e, 0xc6, 0x36, 0x93, 0x82, 0x91, 0x05, 0x2d, 0x76, 0x4f, 0xb1, 0xe2, 0xdb, 0x2a, 0x6f, 0xda,
|
||||
0x17, 0x19, 0xe8, 0x4f, 0x95, 0xfe, 0x45, 0xe8, 0x97, 0x61, 0x5e, 0xc5, 0xe1, 0x6f, 0xe3, 0xc9,
|
||||
0x95, 0x16, 0x8f, 0xbb, 0xf9, 0x3e, 0xe7, 0x84, 0xbc, 0xa7, 0xec, 0x3b, 0xfd, 0x24, 0x3b, 0x53,
|
||||
0x4b, 0x49, 0xbd, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x1b, 0x59, 0xf8, 0xe5, 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 cc_enable_arenas = true;
|
||||
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 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;
|
||||
}
|
||||
+443
@@ -0,0 +1,443 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/protobuf/wrappers.proto
|
||||
|
||||
package wrappers // import "github.com/golang/protobuf/ptypes/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,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *DoubleValue) Reset() { *m = DoubleValue{} }
|
||||
func (m *DoubleValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*DoubleValue) ProtoMessage() {}
|
||||
func (*DoubleValue) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_wrappers_16c7c35c009f3253, []int{0}
|
||||
}
|
||||
func (*DoubleValue) XXX_WellKnownType() string { return "DoubleValue" }
|
||||
func (m *DoubleValue) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_DoubleValue.Unmarshal(m, b)
|
||||
}
|
||||
func (m *DoubleValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_DoubleValue.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *DoubleValue) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_DoubleValue.Merge(dst, src)
|
||||
}
|
||||
func (m *DoubleValue) XXX_Size() int {
|
||||
return xxx_messageInfo_DoubleValue.Size(m)
|
||||
}
|
||||
func (m *DoubleValue) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_DoubleValue.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_DoubleValue proto.InternalMessageInfo
|
||||
|
||||
func (m *DoubleValue) GetValue() float64 {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 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,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *FloatValue) Reset() { *m = FloatValue{} }
|
||||
func (m *FloatValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*FloatValue) ProtoMessage() {}
|
||||
func (*FloatValue) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_wrappers_16c7c35c009f3253, []int{1}
|
||||
}
|
||||
func (*FloatValue) XXX_WellKnownType() string { return "FloatValue" }
|
||||
func (m *FloatValue) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_FloatValue.Unmarshal(m, b)
|
||||
}
|
||||
func (m *FloatValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_FloatValue.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *FloatValue) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_FloatValue.Merge(dst, src)
|
||||
}
|
||||
func (m *FloatValue) XXX_Size() int {
|
||||
return xxx_messageInfo_FloatValue.Size(m)
|
||||
}
|
||||
func (m *FloatValue) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_FloatValue.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_FloatValue proto.InternalMessageInfo
|
||||
|
||||
func (m *FloatValue) GetValue() float32 {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 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,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Int64Value) Reset() { *m = Int64Value{} }
|
||||
func (m *Int64Value) String() string { return proto.CompactTextString(m) }
|
||||
func (*Int64Value) ProtoMessage() {}
|
||||
func (*Int64Value) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_wrappers_16c7c35c009f3253, []int{2}
|
||||
}
|
||||
func (*Int64Value) XXX_WellKnownType() string { return "Int64Value" }
|
||||
func (m *Int64Value) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Int64Value.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Int64Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Int64Value.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Int64Value) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Int64Value.Merge(dst, src)
|
||||
}
|
||||
func (m *Int64Value) XXX_Size() int {
|
||||
return xxx_messageInfo_Int64Value.Size(m)
|
||||
}
|
||||
func (m *Int64Value) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Int64Value.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Int64Value proto.InternalMessageInfo
|
||||
|
||||
func (m *Int64Value) GetValue() int64 {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 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,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *UInt64Value) Reset() { *m = UInt64Value{} }
|
||||
func (m *UInt64Value) String() string { return proto.CompactTextString(m) }
|
||||
func (*UInt64Value) ProtoMessage() {}
|
||||
func (*UInt64Value) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_wrappers_16c7c35c009f3253, []int{3}
|
||||
}
|
||||
func (*UInt64Value) XXX_WellKnownType() string { return "UInt64Value" }
|
||||
func (m *UInt64Value) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UInt64Value.Unmarshal(m, b)
|
||||
}
|
||||
func (m *UInt64Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_UInt64Value.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *UInt64Value) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_UInt64Value.Merge(dst, src)
|
||||
}
|
||||
func (m *UInt64Value) XXX_Size() int {
|
||||
return xxx_messageInfo_UInt64Value.Size(m)
|
||||
}
|
||||
func (m *UInt64Value) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_UInt64Value.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_UInt64Value proto.InternalMessageInfo
|
||||
|
||||
func (m *UInt64Value) GetValue() uint64 {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 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,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Int32Value) Reset() { *m = Int32Value{} }
|
||||
func (m *Int32Value) String() string { return proto.CompactTextString(m) }
|
||||
func (*Int32Value) ProtoMessage() {}
|
||||
func (*Int32Value) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_wrappers_16c7c35c009f3253, []int{4}
|
||||
}
|
||||
func (*Int32Value) XXX_WellKnownType() string { return "Int32Value" }
|
||||
func (m *Int32Value) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Int32Value.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Int32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Int32Value.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Int32Value) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Int32Value.Merge(dst, src)
|
||||
}
|
||||
func (m *Int32Value) XXX_Size() int {
|
||||
return xxx_messageInfo_Int32Value.Size(m)
|
||||
}
|
||||
func (m *Int32Value) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Int32Value.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Int32Value proto.InternalMessageInfo
|
||||
|
||||
func (m *Int32Value) GetValue() int32 {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 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,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *UInt32Value) Reset() { *m = UInt32Value{} }
|
||||
func (m *UInt32Value) String() string { return proto.CompactTextString(m) }
|
||||
func (*UInt32Value) ProtoMessage() {}
|
||||
func (*UInt32Value) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_wrappers_16c7c35c009f3253, []int{5}
|
||||
}
|
||||
func (*UInt32Value) XXX_WellKnownType() string { return "UInt32Value" }
|
||||
func (m *UInt32Value) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UInt32Value.Unmarshal(m, b)
|
||||
}
|
||||
func (m *UInt32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_UInt32Value.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *UInt32Value) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_UInt32Value.Merge(dst, src)
|
||||
}
|
||||
func (m *UInt32Value) XXX_Size() int {
|
||||
return xxx_messageInfo_UInt32Value.Size(m)
|
||||
}
|
||||
func (m *UInt32Value) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_UInt32Value.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_UInt32Value proto.InternalMessageInfo
|
||||
|
||||
func (m *UInt32Value) GetValue() uint32 {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 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,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *BoolValue) Reset() { *m = BoolValue{} }
|
||||
func (m *BoolValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*BoolValue) ProtoMessage() {}
|
||||
func (*BoolValue) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_wrappers_16c7c35c009f3253, []int{6}
|
||||
}
|
||||
func (*BoolValue) XXX_WellKnownType() string { return "BoolValue" }
|
||||
func (m *BoolValue) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_BoolValue.Unmarshal(m, b)
|
||||
}
|
||||
func (m *BoolValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_BoolValue.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *BoolValue) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_BoolValue.Merge(dst, src)
|
||||
}
|
||||
func (m *BoolValue) XXX_Size() int {
|
||||
return xxx_messageInfo_BoolValue.Size(m)
|
||||
}
|
||||
func (m *BoolValue) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_BoolValue.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_BoolValue proto.InternalMessageInfo
|
||||
|
||||
func (m *BoolValue) GetValue() bool {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 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,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StringValue) Reset() { *m = StringValue{} }
|
||||
func (m *StringValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*StringValue) ProtoMessage() {}
|
||||
func (*StringValue) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_wrappers_16c7c35c009f3253, []int{7}
|
||||
}
|
||||
func (*StringValue) XXX_WellKnownType() string { return "StringValue" }
|
||||
func (m *StringValue) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_StringValue.Unmarshal(m, b)
|
||||
}
|
||||
func (m *StringValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_StringValue.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *StringValue) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_StringValue.Merge(dst, src)
|
||||
}
|
||||
func (m *StringValue) XXX_Size() int {
|
||||
return xxx_messageInfo_StringValue.Size(m)
|
||||
}
|
||||
func (m *StringValue) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_StringValue.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_StringValue proto.InternalMessageInfo
|
||||
|
||||
func (m *StringValue) GetValue() string {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// 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"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *BytesValue) Reset() { *m = BytesValue{} }
|
||||
func (m *BytesValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*BytesValue) ProtoMessage() {}
|
||||
func (*BytesValue) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_wrappers_16c7c35c009f3253, []int{8}
|
||||
}
|
||||
func (*BytesValue) XXX_WellKnownType() string { return "BytesValue" }
|
||||
func (m *BytesValue) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_BytesValue.Unmarshal(m, b)
|
||||
}
|
||||
func (m *BytesValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_BytesValue.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *BytesValue) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_BytesValue.Merge(dst, src)
|
||||
}
|
||||
func (m *BytesValue) XXX_Size() int {
|
||||
return xxx_messageInfo_BytesValue.Size(m)
|
||||
}
|
||||
func (m *BytesValue) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_BytesValue.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_BytesValue proto.InternalMessageInfo
|
||||
|
||||
func (m *BytesValue) GetValue() []byte {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
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("google/protobuf/wrappers.proto", fileDescriptor_wrappers_16c7c35c009f3253)
|
||||
}
|
||||
|
||||
var fileDescriptor_wrappers_16c7c35c009f3253 = []byte{
|
||||
// 259 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0x2f, 0x4a, 0x2c,
|
||||
0x28, 0x48, 0x2d, 0x2a, 0xd6, 0x03, 0x8b, 0x08, 0xf1, 0x43, 0xe4, 0xf5, 0x60, 0xf2, 0x4a, 0xca,
|
||||
0x5c, 0xdc, 0x2e, 0xf9, 0xa5, 0x49, 0x39, 0xa9, 0x61, 0x89, 0x39, 0xa5, 0xa9, 0x42, 0x22, 0x5c,
|
||||
0xac, 0x65, 0x20, 0x86, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x63, 0x10, 0x84, 0xa3, 0xa4, 0xc4, 0xc5,
|
||||
0xe5, 0x96, 0x93, 0x9f, 0x58, 0x82, 0x45, 0x0d, 0x13, 0x92, 0x1a, 0xcf, 0xbc, 0x12, 0x33, 0x13,
|
||||
0x2c, 0x6a, 0x98, 0x61, 0x6a, 0x94, 0xb9, 0xb8, 0x43, 0x71, 0x29, 0x62, 0x41, 0x35, 0xc8, 0xd8,
|
||||
0x08, 0x8b, 0x1a, 0x56, 0x34, 0x83, 0xb0, 0x2a, 0xe2, 0x85, 0x29, 0x52, 0xe4, 0xe2, 0x74, 0xca,
|
||||
0xcf, 0xcf, 0xc1, 0xa2, 0x84, 0x03, 0xc9, 0x9c, 0xe0, 0x92, 0xa2, 0xcc, 0xbc, 0x74, 0x2c, 0x8a,
|
||||
0x38, 0x91, 0x1c, 0xe4, 0x54, 0x59, 0x92, 0x5a, 0x8c, 0x45, 0x0d, 0x0f, 0x54, 0x8d, 0x53, 0x0d,
|
||||
0x97, 0x70, 0x72, 0x7e, 0xae, 0x1e, 0x5a, 0xe8, 0x3a, 0xf1, 0x86, 0x43, 0x83, 0x3f, 0x00, 0x24,
|
||||
0x12, 0xc0, 0x18, 0xa5, 0x95, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x9f,
|
||||
0x9e, 0x9f, 0x93, 0x98, 0x97, 0x8e, 0x88, 0xaa, 0x82, 0x92, 0xca, 0x82, 0xd4, 0x62, 0x78, 0x8c,
|
||||
0xfd, 0x60, 0x64, 0x5c, 0xc4, 0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0x62, 0x6e,
|
||||
0x00, 0x54, 0xa9, 0x5e, 0x78, 0x6a, 0x4e, 0x8e, 0x77, 0x5e, 0x7e, 0x79, 0x5e, 0x08, 0x48, 0x4b,
|
||||
0x12, 0x1b, 0xd8, 0x0c, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x19, 0x6c, 0xb9, 0xb8, 0xfe,
|
||||
0x01, 0x00, 0x00,
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
// 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 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;
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
// Copyright 2018, OpenCensus Authors
|
||||
//
|
||||
// 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 ocgrpc
|
||||
|
||||
import (
|
||||
"go.opencensus.io/trace"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"google.golang.org/grpc/stats"
|
||||
)
|
||||
|
||||
// ClientHandler implements a gRPC stats.Handler for recording OpenCensus stats and
|
||||
// traces. Use with gRPC clients only.
|
||||
type ClientHandler struct {
|
||||
// StartOptions allows configuring the StartOptions used to create new spans.
|
||||
//
|
||||
// StartOptions.SpanKind will always be set to trace.SpanKindClient
|
||||
// for spans started by this handler.
|
||||
StartOptions trace.StartOptions
|
||||
}
|
||||
|
||||
// HandleConn exists to satisfy gRPC stats.Handler.
|
||||
func (c *ClientHandler) HandleConn(ctx context.Context, cs stats.ConnStats) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
// TagConn exists to satisfy gRPC stats.Handler.
|
||||
func (c *ClientHandler) TagConn(ctx context.Context, cti *stats.ConnTagInfo) context.Context {
|
||||
// no-op
|
||||
return ctx
|
||||
}
|
||||
|
||||
// HandleRPC implements per-RPC tracing and stats instrumentation.
|
||||
func (c *ClientHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) {
|
||||
traceHandleRPC(ctx, rs)
|
||||
statsHandleRPC(ctx, rs)
|
||||
}
|
||||
|
||||
// TagRPC implements per-RPC context management.
|
||||
func (c *ClientHandler) TagRPC(ctx context.Context, rti *stats.RPCTagInfo) context.Context {
|
||||
ctx = c.traceTagRPC(ctx, rti)
|
||||
ctx = c.statsTagRPC(ctx, rti)
|
||||
return ctx
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
// Copyright 2017, OpenCensus Authors
|
||||
//
|
||||
// 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 ocgrpc
|
||||
|
||||
import (
|
||||
"go.opencensus.io/stats"
|
||||
"go.opencensus.io/stats/view"
|
||||
"go.opencensus.io/tag"
|
||||
)
|
||||
|
||||
// The following variables are measures are recorded by ClientHandler:
|
||||
var (
|
||||
ClientSentMessagesPerRPC = stats.Int64("grpc.io/client/sent_messages_per_rpc", "Number of messages sent in the RPC (always 1 for non-streaming RPCs).", stats.UnitDimensionless)
|
||||
ClientSentBytesPerRPC = stats.Int64("grpc.io/client/sent_bytes_per_rpc", "Total bytes sent across all request messages per RPC.", stats.UnitBytes)
|
||||
ClientReceivedMessagesPerRPC = stats.Int64("grpc.io/client/received_messages_per_rpc", "Number of response messages received per RPC (always 1 for non-streaming RPCs).", stats.UnitDimensionless)
|
||||
ClientReceivedBytesPerRPC = stats.Int64("grpc.io/client/received_bytes_per_rpc", "Total bytes received across all response messages per RPC.", stats.UnitBytes)
|
||||
ClientRoundtripLatency = stats.Float64("grpc.io/client/roundtrip_latency", "Time between first byte of request sent to last byte of response received, or terminal error.", stats.UnitMilliseconds)
|
||||
ClientServerLatency = stats.Float64("grpc.io/client/server_latency", `Propagated from the server and should have the same value as "grpc.io/server/latency".`, stats.UnitMilliseconds)
|
||||
)
|
||||
|
||||
// Predefined views may be registered to collect data for the above measures.
|
||||
// As always, you may also define your own custom views over measures collected by this
|
||||
// package. These are declared as a convenience only; none are registered by
|
||||
// default.
|
||||
var (
|
||||
ClientSentBytesPerRPCView = &view.View{
|
||||
Measure: ClientSentBytesPerRPC,
|
||||
Name: "grpc.io/client/sent_bytes_per_rpc",
|
||||
Description: "Distribution of bytes sent per RPC, by method.",
|
||||
TagKeys: []tag.Key{KeyClientMethod},
|
||||
Aggregation: DefaultBytesDistribution,
|
||||
}
|
||||
|
||||
ClientReceivedBytesPerRPCView = &view.View{
|
||||
Measure: ClientReceivedBytesPerRPC,
|
||||
Name: "grpc.io/client/received_bytes_per_rpc",
|
||||
Description: "Distribution of bytes received per RPC, by method.",
|
||||
TagKeys: []tag.Key{KeyClientMethod},
|
||||
Aggregation: DefaultBytesDistribution,
|
||||
}
|
||||
|
||||
ClientRoundtripLatencyView = &view.View{
|
||||
Measure: ClientRoundtripLatency,
|
||||
Name: "grpc.io/client/roundtrip_latency",
|
||||
Description: "Distribution of round-trip latency, by method.",
|
||||
TagKeys: []tag.Key{KeyClientMethod},
|
||||
Aggregation: DefaultMillisecondsDistribution,
|
||||
}
|
||||
|
||||
ClientCompletedRPCsView = &view.View{
|
||||
Measure: ClientRoundtripLatency,
|
||||
Name: "grpc.io/client/completed_rpcs",
|
||||
Description: "Count of RPCs by method and status.",
|
||||
TagKeys: []tag.Key{KeyClientMethod, KeyClientStatus},
|
||||
Aggregation: view.Count(),
|
||||
}
|
||||
|
||||
ClientSentMessagesPerRPCView = &view.View{
|
||||
Measure: ClientSentMessagesPerRPC,
|
||||
Name: "grpc.io/client/sent_messages_per_rpc",
|
||||
Description: "Distribution of sent messages count per RPC, by method.",
|
||||
TagKeys: []tag.Key{KeyClientMethod},
|
||||
Aggregation: DefaultMessageCountDistribution,
|
||||
}
|
||||
|
||||
ClientReceivedMessagesPerRPCView = &view.View{
|
||||
Measure: ClientReceivedMessagesPerRPC,
|
||||
Name: "grpc.io/client/received_messages_per_rpc",
|
||||
Description: "Distribution of received messages count per RPC, by method.",
|
||||
TagKeys: []tag.Key{KeyClientMethod},
|
||||
Aggregation: DefaultMessageCountDistribution,
|
||||
}
|
||||
|
||||
ClientServerLatencyView = &view.View{
|
||||
Measure: ClientServerLatency,
|
||||
Name: "grpc.io/client/server_latency",
|
||||
Description: "Distribution of server latency as viewed by client, by method.",
|
||||
TagKeys: []tag.Key{KeyClientMethod},
|
||||
Aggregation: DefaultMillisecondsDistribution,
|
||||
}
|
||||
)
|
||||
|
||||
// DefaultClientViews are the default client views provided by this package.
|
||||
var DefaultClientViews = []*view.View{
|
||||
ClientSentBytesPerRPCView,
|
||||
ClientReceivedBytesPerRPCView,
|
||||
ClientRoundtripLatencyView,
|
||||
ClientCompletedRPCsView,
|
||||
}
|
||||
|
||||
// TODO(jbd): Add roundtrip_latency, uncompressed_request_bytes, uncompressed_response_bytes, request_count, response_count.
|
||||
// TODO(acetechnologist): This is temporary and will need to be replaced by a
|
||||
// mechanism to load these defaults from a common repository/config shared by
|
||||
// all supported languages. Likely a serialized protobuf of these defaults.
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
// Copyright 2017, OpenCensus Authors
|
||||
//
|
||||
// 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 ocgrpc
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"go.opencensus.io/tag"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/stats"
|
||||
)
|
||||
|
||||
// statsTagRPC gets the tag.Map populated by the application code, serializes
|
||||
// its tags into the GRPC metadata in order to be sent to the server.
|
||||
func (h *ClientHandler) statsTagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context {
|
||||
startTime := time.Now()
|
||||
if info == nil {
|
||||
if grpclog.V(2) {
|
||||
grpclog.Infof("clientHandler.TagRPC called with nil info.", info.FullMethodName)
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
|
||||
d := &rpcData{
|
||||
startTime: startTime,
|
||||
method: info.FullMethodName,
|
||||
}
|
||||
ts := tag.FromContext(ctx)
|
||||
if ts != nil {
|
||||
encoded := tag.Encode(ts)
|
||||
ctx = stats.SetTags(ctx, encoded)
|
||||
}
|
||||
|
||||
return context.WithValue(ctx, rpcDataKey, d)
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// Copyright 2017, OpenCensus Authors
|
||||
//
|
||||
// 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 ocgrpc contains OpenCensus stats and trace
|
||||
// integrations for gRPC.
|
||||
//
|
||||
// Use ServerHandler for servers and ClientHandler for clients.
|
||||
package ocgrpc // import "go.opencensus.io/plugin/ocgrpc"
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
// Copyright 2018, OpenCensus Authors
|
||||
//
|
||||
// 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 ocgrpc
|
||||
|
||||
import (
|
||||
"go.opencensus.io/trace"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"google.golang.org/grpc/stats"
|
||||
)
|
||||
|
||||
// ServerHandler implements gRPC stats.Handler recording OpenCensus stats and
|
||||
// traces. Use with gRPC servers.
|
||||
//
|
||||
// When installed (see Example), tracing metadata is read from inbound RPCs
|
||||
// by default. If no tracing metadata is present, or if the tracing metadata is
|
||||
// present but the SpanContext isn't sampled, then a new trace may be started
|
||||
// (as determined by Sampler).
|
||||
type ServerHandler struct {
|
||||
// IsPublicEndpoint may be set to true to always start a new trace around
|
||||
// each RPC. Any SpanContext in the RPC metadata will be added as a linked
|
||||
// span instead of making it the parent of the span created around the
|
||||
// server RPC.
|
||||
//
|
||||
// Be aware that if you leave this false (the default) on a public-facing
|
||||
// server, callers will be able to send tracing metadata in gRPC headers
|
||||
// and trigger traces in your backend.
|
||||
IsPublicEndpoint bool
|
||||
|
||||
// StartOptions to use for to spans started around RPCs handled by this server.
|
||||
//
|
||||
// These will apply even if there is tracing metadata already
|
||||
// present on the inbound RPC but the SpanContext is not sampled. This
|
||||
// ensures that each service has some opportunity to be traced. If you would
|
||||
// like to not add any additional traces for this gRPC service, set:
|
||||
//
|
||||
// StartOptions.Sampler = trace.ProbabilitySampler(0.0)
|
||||
//
|
||||
// StartOptions.SpanKind will always be set to trace.SpanKindServer
|
||||
// for spans started by this handler.
|
||||
StartOptions trace.StartOptions
|
||||
}
|
||||
|
||||
var _ stats.Handler = (*ServerHandler)(nil)
|
||||
|
||||
// HandleConn exists to satisfy gRPC stats.Handler.
|
||||
func (s *ServerHandler) HandleConn(ctx context.Context, cs stats.ConnStats) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
// TagConn exists to satisfy gRPC stats.Handler.
|
||||
func (s *ServerHandler) TagConn(ctx context.Context, cti *stats.ConnTagInfo) context.Context {
|
||||
// no-op
|
||||
return ctx
|
||||
}
|
||||
|
||||
// HandleRPC implements per-RPC tracing and stats instrumentation.
|
||||
func (s *ServerHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) {
|
||||
traceHandleRPC(ctx, rs)
|
||||
statsHandleRPC(ctx, rs)
|
||||
}
|
||||
|
||||
// TagRPC implements per-RPC context management.
|
||||
func (s *ServerHandler) TagRPC(ctx context.Context, rti *stats.RPCTagInfo) context.Context {
|
||||
ctx = s.traceTagRPC(ctx, rti)
|
||||
ctx = s.statsTagRPC(ctx, rti)
|
||||
return ctx
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
// Copyright 2017, OpenCensus Authors
|
||||
//
|
||||
// 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 ocgrpc
|
||||
|
||||
import (
|
||||
"go.opencensus.io/stats"
|
||||
"go.opencensus.io/stats/view"
|
||||
"go.opencensus.io/tag"
|
||||
)
|
||||
|
||||
// The following variables are measures are recorded by ServerHandler:
|
||||
var (
|
||||
ServerReceivedMessagesPerRPC = stats.Int64("grpc.io/server/received_messages_per_rpc", "Number of messages received in each RPC. Has value 1 for non-streaming RPCs.", stats.UnitDimensionless)
|
||||
ServerReceivedBytesPerRPC = stats.Int64("grpc.io/server/received_bytes_per_rpc", "Total bytes received across all messages per RPC.", stats.UnitBytes)
|
||||
ServerSentMessagesPerRPC = stats.Int64("grpc.io/server/sent_messages_per_rpc", "Number of messages sent in each RPC. Has value 1 for non-streaming RPCs.", stats.UnitDimensionless)
|
||||
ServerSentBytesPerRPC = stats.Int64("grpc.io/server/sent_bytes_per_rpc", "Total bytes sent in across all response messages per RPC.", stats.UnitBytes)
|
||||
ServerLatency = stats.Float64("grpc.io/server/server_latency", "Time between first byte of request received to last byte of response sent, or terminal error.", stats.UnitMilliseconds)
|
||||
)
|
||||
|
||||
// TODO(acetechnologist): This is temporary and will need to be replaced by a
|
||||
// mechanism to load these defaults from a common repository/config shared by
|
||||
// all supported languages. Likely a serialized protobuf of these defaults.
|
||||
|
||||
// Predefined views may be registered to collect data for the above measures.
|
||||
// As always, you may also define your own custom views over measures collected by this
|
||||
// package. These are declared as a convenience only; none are registered by
|
||||
// default.
|
||||
var (
|
||||
ServerReceivedBytesPerRPCView = &view.View{
|
||||
Name: "grpc.io/server/received_bytes_per_rpc",
|
||||
Description: "Distribution of received bytes per RPC, by method.",
|
||||
Measure: ServerReceivedBytesPerRPC,
|
||||
TagKeys: []tag.Key{KeyServerMethod},
|
||||
Aggregation: DefaultBytesDistribution,
|
||||
}
|
||||
|
||||
ServerSentBytesPerRPCView = &view.View{
|
||||
Name: "grpc.io/server/sent_bytes_per_rpc",
|
||||
Description: "Distribution of total sent bytes per RPC, by method.",
|
||||
Measure: ServerSentBytesPerRPC,
|
||||
TagKeys: []tag.Key{KeyServerMethod},
|
||||
Aggregation: DefaultBytesDistribution,
|
||||
}
|
||||
|
||||
ServerLatencyView = &view.View{
|
||||
Name: "grpc.io/server/server_latency",
|
||||
Description: "Distribution of server latency in milliseconds, by method.",
|
||||
TagKeys: []tag.Key{KeyServerMethod},
|
||||
Measure: ServerLatency,
|
||||
Aggregation: DefaultMillisecondsDistribution,
|
||||
}
|
||||
|
||||
ServerCompletedRPCsView = &view.View{
|
||||
Name: "grpc.io/server/completed_rpcs",
|
||||
Description: "Count of RPCs by method and status.",
|
||||
TagKeys: []tag.Key{KeyServerMethod, KeyServerStatus},
|
||||
Measure: ServerLatency,
|
||||
Aggregation: view.Count(),
|
||||
}
|
||||
|
||||
ServerReceivedMessagesPerRPCView = &view.View{
|
||||
Name: "grpc.io/server/received_messages_per_rpc",
|
||||
Description: "Distribution of messages received count per RPC, by method.",
|
||||
TagKeys: []tag.Key{KeyServerMethod},
|
||||
Measure: ServerReceivedMessagesPerRPC,
|
||||
Aggregation: DefaultMessageCountDistribution,
|
||||
}
|
||||
|
||||
ServerSentMessagesPerRPCView = &view.View{
|
||||
Name: "grpc.io/server/sent_messages_per_rpc",
|
||||
Description: "Distribution of messages sent count per RPC, by method.",
|
||||
TagKeys: []tag.Key{KeyServerMethod},
|
||||
Measure: ServerSentMessagesPerRPC,
|
||||
Aggregation: DefaultMessageCountDistribution,
|
||||
}
|
||||
)
|
||||
|
||||
// DefaultServerViews are the default server views provided by this package.
|
||||
var DefaultServerViews = []*view.View{
|
||||
ServerReceivedBytesPerRPCView,
|
||||
ServerSentBytesPerRPCView,
|
||||
ServerLatencyView,
|
||||
ServerCompletedRPCsView,
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
// Copyright 2017, OpenCensus Authors
|
||||
//
|
||||
// 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 ocgrpc
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"go.opencensus.io/tag"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/stats"
|
||||
)
|
||||
|
||||
// statsTagRPC gets the metadata from gRPC context, extracts the encoded tags from
|
||||
// it and creates a new tag.Map and puts them into the returned context.
|
||||
func (h *ServerHandler) statsTagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context {
|
||||
startTime := time.Now()
|
||||
if info == nil {
|
||||
if grpclog.V(2) {
|
||||
grpclog.Infof("opencensus: TagRPC called with nil info.")
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
d := &rpcData{
|
||||
startTime: startTime,
|
||||
method: info.FullMethodName,
|
||||
}
|
||||
propagated := h.extractPropagatedTags(ctx)
|
||||
ctx = tag.NewContext(ctx, propagated)
|
||||
ctx, _ = tag.New(ctx, tag.Upsert(KeyServerMethod, methodName(info.FullMethodName)))
|
||||
return context.WithValue(ctx, rpcDataKey, d)
|
||||
}
|
||||
|
||||
// extractPropagatedTags creates a new tag map containing the tags extracted from the
|
||||
// gRPC metadata.
|
||||
func (h *ServerHandler) extractPropagatedTags(ctx context.Context) *tag.Map {
|
||||
buf := stats.Tags(ctx)
|
||||
if buf == nil {
|
||||
return nil
|
||||
}
|
||||
propagated, err := tag.Decode(buf)
|
||||
if err != nil {
|
||||
if grpclog.V(2) {
|
||||
grpclog.Warningf("opencensus: Failed to decode tags from gRPC metadata failed to decode: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return propagated
|
||||
}
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
// Copyright 2017, OpenCensus Authors
|
||||
//
|
||||
// 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 ocgrpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
ocstats "go.opencensus.io/stats"
|
||||
"go.opencensus.io/stats/view"
|
||||
"go.opencensus.io/tag"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/stats"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
type grpcInstrumentationKey string
|
||||
|
||||
// rpcData holds the instrumentation RPC data that is needed between the start
|
||||
// and end of an call. It holds the info that this package needs to keep track
|
||||
// of between the various GRPC events.
|
||||
type rpcData struct {
|
||||
// reqCount and respCount has to be the first words
|
||||
// in order to be 64-aligned on 32-bit architectures.
|
||||
sentCount, sentBytes, recvCount, recvBytes int64 // access atomically
|
||||
|
||||
// startTime represents the time at which TagRPC was invoked at the
|
||||
// beginning of an RPC. It is an appoximation of the time when the
|
||||
// application code invoked GRPC code.
|
||||
startTime time.Time
|
||||
method string
|
||||
}
|
||||
|
||||
// The following variables define the default hard-coded auxiliary data used by
|
||||
// both the default GRPC client and GRPC server metrics.
|
||||
var (
|
||||
DefaultBytesDistribution = view.Distribution(0, 1024, 2048, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216, 67108864, 268435456, 1073741824, 4294967296)
|
||||
DefaultMillisecondsDistribution = view.Distribution(0, 0.01, 0.05, 0.1, 0.3, 0.6, 0.8, 1, 2, 3, 4, 5, 6, 8, 10, 13, 16, 20, 25, 30, 40, 50, 65, 80, 100, 130, 160, 200, 250, 300, 400, 500, 650, 800, 1000, 2000, 5000, 10000, 20000, 50000, 100000)
|
||||
DefaultMessageCountDistribution = view.Distribution(0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536)
|
||||
)
|
||||
|
||||
// Server tags are applied to the context used to process each RPC, as well as
|
||||
// the measures at the end of each RPC.
|
||||
var (
|
||||
KeyServerMethod, _ = tag.NewKey("grpc_server_method")
|
||||
KeyServerStatus, _ = tag.NewKey("grpc_server_status")
|
||||
)
|
||||
|
||||
// Client tags are applied to measures at the end of each RPC.
|
||||
var (
|
||||
KeyClientMethod, _ = tag.NewKey("grpc_client_method")
|
||||
KeyClientStatus, _ = tag.NewKey("grpc_client_status")
|
||||
)
|
||||
|
||||
var (
|
||||
rpcDataKey = grpcInstrumentationKey("opencensus-rpcData")
|
||||
)
|
||||
|
||||
func methodName(fullname string) string {
|
||||
return strings.TrimLeft(fullname, "/")
|
||||
}
|
||||
|
||||
// statsHandleRPC processes the RPC events.
|
||||
func statsHandleRPC(ctx context.Context, s stats.RPCStats) {
|
||||
switch st := s.(type) {
|
||||
case *stats.Begin, *stats.OutHeader, *stats.InHeader, *stats.InTrailer, *stats.OutTrailer:
|
||||
// do nothing for client
|
||||
case *stats.OutPayload:
|
||||
handleRPCOutPayload(ctx, st)
|
||||
case *stats.InPayload:
|
||||
handleRPCInPayload(ctx, st)
|
||||
case *stats.End:
|
||||
handleRPCEnd(ctx, st)
|
||||
default:
|
||||
grpclog.Infof("unexpected stats: %T", st)
|
||||
}
|
||||
}
|
||||
|
||||
func handleRPCOutPayload(ctx context.Context, s *stats.OutPayload) {
|
||||
d, ok := ctx.Value(rpcDataKey).(*rpcData)
|
||||
if !ok {
|
||||
if grpclog.V(2) {
|
||||
grpclog.Infoln("Failed to retrieve *rpcData from context.")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
atomic.AddInt64(&d.sentBytes, int64(s.Length))
|
||||
atomic.AddInt64(&d.sentCount, 1)
|
||||
}
|
||||
|
||||
func handleRPCInPayload(ctx context.Context, s *stats.InPayload) {
|
||||
d, ok := ctx.Value(rpcDataKey).(*rpcData)
|
||||
if !ok {
|
||||
if grpclog.V(2) {
|
||||
grpclog.Infoln("Failed to retrieve *rpcData from context.")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
atomic.AddInt64(&d.recvBytes, int64(s.Length))
|
||||
atomic.AddInt64(&d.recvCount, 1)
|
||||
}
|
||||
|
||||
func handleRPCEnd(ctx context.Context, s *stats.End) {
|
||||
d, ok := ctx.Value(rpcDataKey).(*rpcData)
|
||||
if !ok {
|
||||
if grpclog.V(2) {
|
||||
grpclog.Infoln("Failed to retrieve *rpcData from context.")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
elapsedTime := time.Since(d.startTime)
|
||||
|
||||
var st string
|
||||
if s.Error != nil {
|
||||
s, ok := status.FromError(s.Error)
|
||||
if ok {
|
||||
st = statusCodeToString(s)
|
||||
}
|
||||
} else {
|
||||
st = "OK"
|
||||
}
|
||||
|
||||
latencyMillis := float64(elapsedTime) / float64(time.Millisecond)
|
||||
if s.Client {
|
||||
ctx, _ = tag.New(ctx,
|
||||
tag.Upsert(KeyClientMethod, methodName(d.method)),
|
||||
tag.Upsert(KeyClientStatus, st))
|
||||
ocstats.Record(ctx,
|
||||
ClientSentBytesPerRPC.M(atomic.LoadInt64(&d.sentBytes)),
|
||||
ClientSentMessagesPerRPC.M(atomic.LoadInt64(&d.sentCount)),
|
||||
ClientReceivedMessagesPerRPC.M(atomic.LoadInt64(&d.recvCount)),
|
||||
ClientReceivedBytesPerRPC.M(atomic.LoadInt64(&d.recvBytes)),
|
||||
ClientRoundtripLatency.M(latencyMillis))
|
||||
} else {
|
||||
ctx, _ = tag.New(ctx, tag.Upsert(KeyServerStatus, st))
|
||||
ocstats.Record(ctx,
|
||||
ServerSentBytesPerRPC.M(atomic.LoadInt64(&d.sentBytes)),
|
||||
ServerSentMessagesPerRPC.M(atomic.LoadInt64(&d.sentCount)),
|
||||
ServerReceivedMessagesPerRPC.M(atomic.LoadInt64(&d.recvCount)),
|
||||
ServerReceivedBytesPerRPC.M(atomic.LoadInt64(&d.recvBytes)),
|
||||
ServerLatency.M(latencyMillis))
|
||||
}
|
||||
}
|
||||
|
||||
func statusCodeToString(s *status.Status) string {
|
||||
// see https://github.com/grpc/grpc/blob/master/doc/statuscodes.md
|
||||
switch c := s.Code(); c {
|
||||
case codes.OK:
|
||||
return "OK"
|
||||
case codes.Canceled:
|
||||
return "CANCELLED"
|
||||
case codes.Unknown:
|
||||
return "UNKNOWN"
|
||||
case codes.InvalidArgument:
|
||||
return "INVALID_ARGUMENT"
|
||||
case codes.DeadlineExceeded:
|
||||
return "DEADLINE_EXCEEDED"
|
||||
case codes.NotFound:
|
||||
return "NOT_FOUND"
|
||||
case codes.AlreadyExists:
|
||||
return "ALREADY_EXISTS"
|
||||
case codes.PermissionDenied:
|
||||
return "PERMISSION_DENIED"
|
||||
case codes.ResourceExhausted:
|
||||
return "RESOURCE_EXHAUSTED"
|
||||
case codes.FailedPrecondition:
|
||||
return "FAILED_PRECONDITION"
|
||||
case codes.Aborted:
|
||||
return "ABORTED"
|
||||
case codes.OutOfRange:
|
||||
return "OUT_OF_RANGE"
|
||||
case codes.Unimplemented:
|
||||
return "UNIMPLEMENTED"
|
||||
case codes.Internal:
|
||||
return "INTERNAL"
|
||||
case codes.Unavailable:
|
||||
return "UNAVAILABLE"
|
||||
case codes.DataLoss:
|
||||
return "DATA_LOSS"
|
||||
case codes.Unauthenticated:
|
||||
return "UNAUTHENTICATED"
|
||||
default:
|
||||
return "CODE_" + strconv.FormatInt(int64(c), 10)
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
// Copyright 2017, OpenCensus Authors
|
||||
//
|
||||
// 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 ocgrpc
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
|
||||
"go.opencensus.io/trace"
|
||||
"go.opencensus.io/trace/propagation"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/stats"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
const traceContextKey = "grpc-trace-bin"
|
||||
|
||||
// TagRPC creates a new trace span for the client side of the RPC.
|
||||
//
|
||||
// It returns ctx with the new trace span added and a serialization of the
|
||||
// SpanContext added to the outgoing gRPC metadata.
|
||||
func (c *ClientHandler) traceTagRPC(ctx context.Context, rti *stats.RPCTagInfo) context.Context {
|
||||
name := strings.TrimPrefix(rti.FullMethodName, "/")
|
||||
name = strings.Replace(name, "/", ".", -1)
|
||||
ctx, span := trace.StartSpan(ctx, name,
|
||||
trace.WithSampler(c.StartOptions.Sampler),
|
||||
trace.WithSpanKind(trace.SpanKindClient)) // span is ended by traceHandleRPC
|
||||
traceContextBinary := propagation.Binary(span.SpanContext())
|
||||
return metadata.AppendToOutgoingContext(ctx, traceContextKey, string(traceContextBinary))
|
||||
}
|
||||
|
||||
// TagRPC creates a new trace span for the server side of the RPC.
|
||||
//
|
||||
// It checks the incoming gRPC metadata in ctx for a SpanContext, and if
|
||||
// it finds one, uses that SpanContext as the parent context of the new span.
|
||||
//
|
||||
// It returns ctx, with the new trace span added.
|
||||
func (s *ServerHandler) traceTagRPC(ctx context.Context, rti *stats.RPCTagInfo) context.Context {
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
name := strings.TrimPrefix(rti.FullMethodName, "/")
|
||||
name = strings.Replace(name, "/", ".", -1)
|
||||
traceContext := md[traceContextKey]
|
||||
var (
|
||||
parent trace.SpanContext
|
||||
haveParent bool
|
||||
)
|
||||
if len(traceContext) > 0 {
|
||||
// Metadata with keys ending in -bin are actually binary. They are base64
|
||||
// encoded before being put on the wire, see:
|
||||
// https://github.com/grpc/grpc-go/blob/08d6261/Documentation/grpc-metadata.md#storing-binary-data-in-metadata
|
||||
traceContextBinary := []byte(traceContext[0])
|
||||
parent, haveParent = propagation.FromBinary(traceContextBinary)
|
||||
if haveParent && !s.IsPublicEndpoint {
|
||||
ctx, _ := trace.StartSpanWithRemoteParent(ctx, name, parent,
|
||||
trace.WithSpanKind(trace.SpanKindServer),
|
||||
trace.WithSampler(s.StartOptions.Sampler),
|
||||
)
|
||||
return ctx
|
||||
}
|
||||
}
|
||||
ctx, span := trace.StartSpan(ctx, name,
|
||||
trace.WithSpanKind(trace.SpanKindServer),
|
||||
trace.WithSampler(s.StartOptions.Sampler))
|
||||
if haveParent {
|
||||
span.AddLink(trace.Link{TraceID: parent.TraceID, SpanID: parent.SpanID, Type: trace.LinkTypeChild})
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
|
||||
func traceHandleRPC(ctx context.Context, rs stats.RPCStats) {
|
||||
span := trace.FromContext(ctx)
|
||||
// TODO: compressed and uncompressed sizes are not populated in every message.
|
||||
switch rs := rs.(type) {
|
||||
case *stats.Begin:
|
||||
span.AddAttributes(
|
||||
trace.BoolAttribute("Client", rs.Client),
|
||||
trace.BoolAttribute("FailFast", rs.FailFast))
|
||||
case *stats.InPayload:
|
||||
span.AddMessageReceiveEvent(0 /* TODO: messageID */, int64(rs.Length), int64(rs.WireLength))
|
||||
case *stats.OutPayload:
|
||||
span.AddMessageSendEvent(0, int64(rs.Length), int64(rs.WireLength))
|
||||
case *stats.End:
|
||||
if rs.Error != nil {
|
||||
s, ok := status.FromError(rs.Error)
|
||||
if ok {
|
||||
span.SetStatus(trace.Status{Code: int32(s.Code()), Message: s.Message()})
|
||||
} else {
|
||||
span.SetStatus(trace.Status{Code: int32(codes.Internal), Message: rs.Error.Error()})
|
||||
}
|
||||
}
|
||||
span.End()
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
// 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 (
|
||||
"net/http"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"google.golang.org/api/option"
|
||||
gtransport "google.golang.org/api/transport/grpc"
|
||||
htransport "google.golang.org/api/transport/http"
|
||||
)
|
||||
|
||||
// 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) {
|
||||
return htransport.NewClient(ctx, opts...)
|
||||
}
|
||||
|
||||
// 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) {
|
||||
return gtransport.Dial(ctx, opts...)
|
||||
}
|
||||
|
||||
// DialGRPCInsecure returns an insecure GRPC connection for use communicating
|
||||
// with fake or mock Google cloud service implementations, such as emulators.
|
||||
// The connection is configured with the given ClientOptions.
|
||||
func DialGRPCInsecure(ctx context.Context, opts ...option.ClientOption) (*grpc.ClientConn, error) {
|
||||
return gtransport.DialInsecure(ctx, opts...)
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// Copyright 2018 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.
|
||||
|
||||
// +build go1.9
|
||||
|
||||
package transport
|
||||
|
||||
import (
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/oauth2/google"
|
||||
"google.golang.org/api/internal"
|
||||
"google.golang.org/api/option"
|
||||
)
|
||||
|
||||
// Creds constructs a google.Credentials from the information in the options,
|
||||
// or obtains the default credentials in the same way as google.FindDefaultCredentials.
|
||||
func Creds(ctx context.Context, opts ...option.ClientOption) (*google.Credentials, error) {
|
||||
var ds internal.DialSettings
|
||||
for _, opt := range opts {
|
||||
opt.Apply(&ds)
|
||||
}
|
||||
return internal.Creds(ctx, &ds)
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
// 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/grpc supports network connections to 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 grpc
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/api/internal"
|
||||
"google.golang.org/api/option"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/grpc/credentials/oauth"
|
||||
)
|
||||
|
||||
// Set at init time by dial_appengine.go. If nil, we're not on App Engine.
|
||||
var appengineDialerHook func(context.Context) grpc.DialOption
|
||||
|
||||
// Dial returns a GRPC connection for use communicating with a Google cloud
|
||||
// service, configured with the given ClientOptions.
|
||||
func Dial(ctx context.Context, opts ...option.ClientOption) (*grpc.ClientConn, error) {
|
||||
return dial(ctx, false, opts)
|
||||
}
|
||||
|
||||
// DialInsecure returns an insecure GRPC connection for use communicating
|
||||
// with fake or mock Google cloud service implementations, such as emulators.
|
||||
// The connection is configured with the given ClientOptions.
|
||||
func DialInsecure(ctx context.Context, opts ...option.ClientOption) (*grpc.ClientConn, error) {
|
||||
return dial(ctx, true, opts)
|
||||
}
|
||||
|
||||
func dial(ctx context.Context, insecure bool, opts []option.ClientOption) (*grpc.ClientConn, error) {
|
||||
var o internal.DialSettings
|
||||
for _, opt := range opts {
|
||||
opt.Apply(&o)
|
||||
}
|
||||
if err := o.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if o.HTTPClient != nil {
|
||||
return nil, errors.New("unsupported HTTP client specified")
|
||||
}
|
||||
if o.GRPCConn != nil {
|
||||
return o.GRPCConn, nil
|
||||
}
|
||||
var grpcOpts []grpc.DialOption
|
||||
if insecure {
|
||||
grpcOpts = []grpc.DialOption{grpc.WithInsecure()}
|
||||
} else if !o.NoAuth {
|
||||
if o.APIKey != "" {
|
||||
log.Print("API keys are not supported for gRPC APIs. Remove the WithAPIKey option from your client-creating call.")
|
||||
}
|
||||
creds, err := internal.Creds(ctx, &o)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
grpcOpts = []grpc.DialOption{
|
||||
grpc.WithPerRPCCredentials(oauth.TokenSource{creds.TokenSource}),
|
||||
grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, "")),
|
||||
}
|
||||
}
|
||||
if appengineDialerHook != nil {
|
||||
// Use the Socket API on App Engine.
|
||||
grpcOpts = append(grpcOpts, appengineDialerHook(ctx))
|
||||
}
|
||||
// Add tracing, but before the other options, so that clients can override the
|
||||
// gRPC stats handler.
|
||||
// This assumes that gRPC options are processed in order, left to right.
|
||||
grpcOpts = addOCStatsHandler(grpcOpts)
|
||||
grpcOpts = append(grpcOpts, o.GRPCDialOpts...)
|
||||
if o.UserAgent != "" {
|
||||
grpcOpts = append(grpcOpts, grpc.WithUserAgent(o.UserAgent))
|
||||
}
|
||||
return grpc.DialContext(ctx, o.Endpoint, grpcOpts...)
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
// 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.
|
||||
|
||||
// +build appengine
|
||||
|
||||
package grpc
|
||||
|
||||
import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/appengine"
|
||||
"google.golang.org/appengine/socket"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// NOTE: dev_appserver doesn't currently support SSL.
|
||||
// When it does, this code can be removed.
|
||||
if appengine.IsDevAppServer() {
|
||||
return
|
||||
}
|
||||
|
||||
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)
|
||||
})
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// Copyright 2018 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.
|
||||
|
||||
// +build go1.8
|
||||
|
||||
package grpc
|
||||
|
||||
import (
|
||||
"go.opencensus.io/plugin/ocgrpc"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func addOCStatsHandler(opts []grpc.DialOption) []grpc.DialOption {
|
||||
return append(opts, grpc.WithStatsHandler(&ocgrpc.ClientHandler{}))
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// Copyright 2018 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.
|
||||
|
||||
// +build !go1.8
|
||||
|
||||
package grpc
|
||||
|
||||
import "google.golang.org/grpc"
|
||||
|
||||
func addOCStatsHandler(opts []grpc.DialOption) []grpc.DialOption { return opts }
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// Copyright 2018 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.
|
||||
|
||||
// +build !go1.9
|
||||
|
||||
package transport
|
||||
|
||||
import (
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/oauth2/google"
|
||||
"google.golang.org/api/internal"
|
||||
"google.golang.org/api/option"
|
||||
)
|
||||
|
||||
// Creds constructs a google.DefaultCredentials from the information in the options,
|
||||
// or obtains the default credentials in the same way as google.FindDefaultCredentials.
|
||||
func Creds(ctx context.Context, opts ...option.ClientOption) (*google.DefaultCredentials, error) {
|
||||
var ds internal.DialSettings
|
||||
for _, opt := range opts {
|
||||
opt.Apply(&ds)
|
||||
}
|
||||
return internal.Creds(ctx, &ds)
|
||||
}
|
||||
+2142
File diff suppressed because it is too large
Load Diff
+460
@@ -0,0 +1,460 @@
|
||||
syntax = "proto2";
|
||||
option go_package = "socket";
|
||||
|
||||
package appengine;
|
||||
|
||||
message RemoteSocketServiceError {
|
||||
enum ErrorCode {
|
||||
SYSTEM_ERROR = 1;
|
||||
GAI_ERROR = 2;
|
||||
FAILURE = 4;
|
||||
PERMISSION_DENIED = 5;
|
||||
INVALID_REQUEST = 6;
|
||||
SOCKET_CLOSED = 7;
|
||||
}
|
||||
|
||||
enum SystemError {
|
||||
option allow_alias = true;
|
||||
|
||||
SYS_SUCCESS = 0;
|
||||
SYS_EPERM = 1;
|
||||
SYS_ENOENT = 2;
|
||||
SYS_ESRCH = 3;
|
||||
SYS_EINTR = 4;
|
||||
SYS_EIO = 5;
|
||||
SYS_ENXIO = 6;
|
||||
SYS_E2BIG = 7;
|
||||
SYS_ENOEXEC = 8;
|
||||
SYS_EBADF = 9;
|
||||
SYS_ECHILD = 10;
|
||||
SYS_EAGAIN = 11;
|
||||
SYS_EWOULDBLOCK = 11;
|
||||
SYS_ENOMEM = 12;
|
||||
SYS_EACCES = 13;
|
||||
SYS_EFAULT = 14;
|
||||
SYS_ENOTBLK = 15;
|
||||
SYS_EBUSY = 16;
|
||||
SYS_EEXIST = 17;
|
||||
SYS_EXDEV = 18;
|
||||
SYS_ENODEV = 19;
|
||||
SYS_ENOTDIR = 20;
|
||||
SYS_EISDIR = 21;
|
||||
SYS_EINVAL = 22;
|
||||
SYS_ENFILE = 23;
|
||||
SYS_EMFILE = 24;
|
||||
SYS_ENOTTY = 25;
|
||||
SYS_ETXTBSY = 26;
|
||||
SYS_EFBIG = 27;
|
||||
SYS_ENOSPC = 28;
|
||||
SYS_ESPIPE = 29;
|
||||
SYS_EROFS = 30;
|
||||
SYS_EMLINK = 31;
|
||||
SYS_EPIPE = 32;
|
||||
SYS_EDOM = 33;
|
||||
SYS_ERANGE = 34;
|
||||
SYS_EDEADLK = 35;
|
||||
SYS_EDEADLOCK = 35;
|
||||
SYS_ENAMETOOLONG = 36;
|
||||
SYS_ENOLCK = 37;
|
||||
SYS_ENOSYS = 38;
|
||||
SYS_ENOTEMPTY = 39;
|
||||
SYS_ELOOP = 40;
|
||||
SYS_ENOMSG = 42;
|
||||
SYS_EIDRM = 43;
|
||||
SYS_ECHRNG = 44;
|
||||
SYS_EL2NSYNC = 45;
|
||||
SYS_EL3HLT = 46;
|
||||
SYS_EL3RST = 47;
|
||||
SYS_ELNRNG = 48;
|
||||
SYS_EUNATCH = 49;
|
||||
SYS_ENOCSI = 50;
|
||||
SYS_EL2HLT = 51;
|
||||
SYS_EBADE = 52;
|
||||
SYS_EBADR = 53;
|
||||
SYS_EXFULL = 54;
|
||||
SYS_ENOANO = 55;
|
||||
SYS_EBADRQC = 56;
|
||||
SYS_EBADSLT = 57;
|
||||
SYS_EBFONT = 59;
|
||||
SYS_ENOSTR = 60;
|
||||
SYS_ENODATA = 61;
|
||||
SYS_ETIME = 62;
|
||||
SYS_ENOSR = 63;
|
||||
SYS_ENONET = 64;
|
||||
SYS_ENOPKG = 65;
|
||||
SYS_EREMOTE = 66;
|
||||
SYS_ENOLINK = 67;
|
||||
SYS_EADV = 68;
|
||||
SYS_ESRMNT = 69;
|
||||
SYS_ECOMM = 70;
|
||||
SYS_EPROTO = 71;
|
||||
SYS_EMULTIHOP = 72;
|
||||
SYS_EDOTDOT = 73;
|
||||
SYS_EBADMSG = 74;
|
||||
SYS_EOVERFLOW = 75;
|
||||
SYS_ENOTUNIQ = 76;
|
||||
SYS_EBADFD = 77;
|
||||
SYS_EREMCHG = 78;
|
||||
SYS_ELIBACC = 79;
|
||||
SYS_ELIBBAD = 80;
|
||||
SYS_ELIBSCN = 81;
|
||||
SYS_ELIBMAX = 82;
|
||||
SYS_ELIBEXEC = 83;
|
||||
SYS_EILSEQ = 84;
|
||||
SYS_ERESTART = 85;
|
||||
SYS_ESTRPIPE = 86;
|
||||
SYS_EUSERS = 87;
|
||||
SYS_ENOTSOCK = 88;
|
||||
SYS_EDESTADDRREQ = 89;
|
||||
SYS_EMSGSIZE = 90;
|
||||
SYS_EPROTOTYPE = 91;
|
||||
SYS_ENOPROTOOPT = 92;
|
||||
SYS_EPROTONOSUPPORT = 93;
|
||||
SYS_ESOCKTNOSUPPORT = 94;
|
||||
SYS_EOPNOTSUPP = 95;
|
||||
SYS_ENOTSUP = 95;
|
||||
SYS_EPFNOSUPPORT = 96;
|
||||
SYS_EAFNOSUPPORT = 97;
|
||||
SYS_EADDRINUSE = 98;
|
||||
SYS_EADDRNOTAVAIL = 99;
|
||||
SYS_ENETDOWN = 100;
|
||||
SYS_ENETUNREACH = 101;
|
||||
SYS_ENETRESET = 102;
|
||||
SYS_ECONNABORTED = 103;
|
||||
SYS_ECONNRESET = 104;
|
||||
SYS_ENOBUFS = 105;
|
||||
SYS_EISCONN = 106;
|
||||
SYS_ENOTCONN = 107;
|
||||
SYS_ESHUTDOWN = 108;
|
||||
SYS_ETOOMANYREFS = 109;
|
||||
SYS_ETIMEDOUT = 110;
|
||||
SYS_ECONNREFUSED = 111;
|
||||
SYS_EHOSTDOWN = 112;
|
||||
SYS_EHOSTUNREACH = 113;
|
||||
SYS_EALREADY = 114;
|
||||
SYS_EINPROGRESS = 115;
|
||||
SYS_ESTALE = 116;
|
||||
SYS_EUCLEAN = 117;
|
||||
SYS_ENOTNAM = 118;
|
||||
SYS_ENAVAIL = 119;
|
||||
SYS_EISNAM = 120;
|
||||
SYS_EREMOTEIO = 121;
|
||||
SYS_EDQUOT = 122;
|
||||
SYS_ENOMEDIUM = 123;
|
||||
SYS_EMEDIUMTYPE = 124;
|
||||
SYS_ECANCELED = 125;
|
||||
SYS_ENOKEY = 126;
|
||||
SYS_EKEYEXPIRED = 127;
|
||||
SYS_EKEYREVOKED = 128;
|
||||
SYS_EKEYREJECTED = 129;
|
||||
SYS_EOWNERDEAD = 130;
|
||||
SYS_ENOTRECOVERABLE = 131;
|
||||
SYS_ERFKILL = 132;
|
||||
}
|
||||
|
||||
optional int32 system_error = 1 [default=0];
|
||||
optional string error_detail = 2;
|
||||
}
|
||||
|
||||
message AddressPort {
|
||||
required int32 port = 1;
|
||||
optional bytes packed_address = 2;
|
||||
|
||||
optional string hostname_hint = 3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
message CreateSocketRequest {
|
||||
enum SocketFamily {
|
||||
IPv4 = 1;
|
||||
IPv6 = 2;
|
||||
}
|
||||
|
||||
enum SocketProtocol {
|
||||
TCP = 1;
|
||||
UDP = 2;
|
||||
}
|
||||
|
||||
required SocketFamily family = 1;
|
||||
required SocketProtocol protocol = 2;
|
||||
|
||||
repeated SocketOption socket_options = 3;
|
||||
|
||||
optional AddressPort proxy_external_ip = 4;
|
||||
|
||||
optional int32 listen_backlog = 5 [default=0];
|
||||
|
||||
optional AddressPort remote_ip = 6;
|
||||
|
||||
optional string app_id = 9;
|
||||
|
||||
optional int64 project_id = 10;
|
||||
}
|
||||
|
||||
message CreateSocketReply {
|
||||
optional string socket_descriptor = 1;
|
||||
|
||||
optional AddressPort server_address = 3;
|
||||
|
||||
optional AddressPort proxy_external_ip = 4;
|
||||
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
|
||||
|
||||
message BindRequest {
|
||||
required string socket_descriptor = 1;
|
||||
required AddressPort proxy_external_ip = 2;
|
||||
}
|
||||
|
||||
message BindReply {
|
||||
optional AddressPort proxy_external_ip = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
message GetSocketNameRequest {
|
||||
required string socket_descriptor = 1;
|
||||
}
|
||||
|
||||
message GetSocketNameReply {
|
||||
optional AddressPort proxy_external_ip = 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
message GetPeerNameRequest {
|
||||
required string socket_descriptor = 1;
|
||||
}
|
||||
|
||||
message GetPeerNameReply {
|
||||
optional AddressPort peer_ip = 2;
|
||||
}
|
||||
|
||||
|
||||
message SocketOption {
|
||||
|
||||
enum SocketOptionLevel {
|
||||
SOCKET_SOL_IP = 0;
|
||||
SOCKET_SOL_SOCKET = 1;
|
||||
SOCKET_SOL_TCP = 6;
|
||||
SOCKET_SOL_UDP = 17;
|
||||
}
|
||||
|
||||
enum SocketOptionName {
|
||||
option allow_alias = true;
|
||||
|
||||
SOCKET_SO_DEBUG = 1;
|
||||
SOCKET_SO_REUSEADDR = 2;
|
||||
SOCKET_SO_TYPE = 3;
|
||||
SOCKET_SO_ERROR = 4;
|
||||
SOCKET_SO_DONTROUTE = 5;
|
||||
SOCKET_SO_BROADCAST = 6;
|
||||
SOCKET_SO_SNDBUF = 7;
|
||||
SOCKET_SO_RCVBUF = 8;
|
||||
SOCKET_SO_KEEPALIVE = 9;
|
||||
SOCKET_SO_OOBINLINE = 10;
|
||||
SOCKET_SO_LINGER = 13;
|
||||
SOCKET_SO_RCVTIMEO = 20;
|
||||
SOCKET_SO_SNDTIMEO = 21;
|
||||
|
||||
SOCKET_IP_TOS = 1;
|
||||
SOCKET_IP_TTL = 2;
|
||||
SOCKET_IP_HDRINCL = 3;
|
||||
SOCKET_IP_OPTIONS = 4;
|
||||
|
||||
SOCKET_TCP_NODELAY = 1;
|
||||
SOCKET_TCP_MAXSEG = 2;
|
||||
SOCKET_TCP_CORK = 3;
|
||||
SOCKET_TCP_KEEPIDLE = 4;
|
||||
SOCKET_TCP_KEEPINTVL = 5;
|
||||
SOCKET_TCP_KEEPCNT = 6;
|
||||
SOCKET_TCP_SYNCNT = 7;
|
||||
SOCKET_TCP_LINGER2 = 8;
|
||||
SOCKET_TCP_DEFER_ACCEPT = 9;
|
||||
SOCKET_TCP_WINDOW_CLAMP = 10;
|
||||
SOCKET_TCP_INFO = 11;
|
||||
SOCKET_TCP_QUICKACK = 12;
|
||||
}
|
||||
|
||||
required SocketOptionLevel level = 1;
|
||||
required SocketOptionName option = 2;
|
||||
required bytes value = 3;
|
||||
}
|
||||
|
||||
|
||||
message SetSocketOptionsRequest {
|
||||
required string socket_descriptor = 1;
|
||||
repeated SocketOption options = 2;
|
||||
}
|
||||
|
||||
message SetSocketOptionsReply {
|
||||
}
|
||||
|
||||
message GetSocketOptionsRequest {
|
||||
required string socket_descriptor = 1;
|
||||
repeated SocketOption options = 2;
|
||||
}
|
||||
|
||||
message GetSocketOptionsReply {
|
||||
repeated SocketOption options = 2;
|
||||
}
|
||||
|
||||
|
||||
message ConnectRequest {
|
||||
required string socket_descriptor = 1;
|
||||
required AddressPort remote_ip = 2;
|
||||
optional double timeout_seconds = 3 [default=-1];
|
||||
}
|
||||
|
||||
message ConnectReply {
|
||||
optional AddressPort proxy_external_ip = 1;
|
||||
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
|
||||
message ListenRequest {
|
||||
required string socket_descriptor = 1;
|
||||
required int32 backlog = 2;
|
||||
}
|
||||
|
||||
message ListenReply {
|
||||
}
|
||||
|
||||
|
||||
message AcceptRequest {
|
||||
required string socket_descriptor = 1;
|
||||
optional double timeout_seconds = 2 [default=-1];
|
||||
}
|
||||
|
||||
message AcceptReply {
|
||||
optional bytes new_socket_descriptor = 2;
|
||||
optional AddressPort remote_address = 3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
message ShutDownRequest {
|
||||
enum How {
|
||||
SOCKET_SHUT_RD = 1;
|
||||
SOCKET_SHUT_WR = 2;
|
||||
SOCKET_SHUT_RDWR = 3;
|
||||
}
|
||||
required string socket_descriptor = 1;
|
||||
required How how = 2;
|
||||
required int64 send_offset = 3;
|
||||
}
|
||||
|
||||
message ShutDownReply {
|
||||
}
|
||||
|
||||
|
||||
|
||||
message CloseRequest {
|
||||
required string socket_descriptor = 1;
|
||||
optional int64 send_offset = 2 [default=-1];
|
||||
}
|
||||
|
||||
message CloseReply {
|
||||
}
|
||||
|
||||
|
||||
|
||||
message SendRequest {
|
||||
required string socket_descriptor = 1;
|
||||
required bytes data = 2 [ctype=CORD];
|
||||
required int64 stream_offset = 3;
|
||||
optional int32 flags = 4 [default=0];
|
||||
optional AddressPort send_to = 5;
|
||||
optional double timeout_seconds = 6 [default=-1];
|
||||
}
|
||||
|
||||
message SendReply {
|
||||
optional int32 data_sent = 1;
|
||||
}
|
||||
|
||||
|
||||
message ReceiveRequest {
|
||||
enum Flags {
|
||||
MSG_OOB = 1;
|
||||
MSG_PEEK = 2;
|
||||
}
|
||||
required string socket_descriptor = 1;
|
||||
required int32 data_size = 2;
|
||||
optional int32 flags = 3 [default=0];
|
||||
optional double timeout_seconds = 5 [default=-1];
|
||||
}
|
||||
|
||||
message ReceiveReply {
|
||||
optional int64 stream_offset = 2;
|
||||
optional bytes data = 3 [ctype=CORD];
|
||||
optional AddressPort received_from = 4;
|
||||
optional int32 buffer_size = 5;
|
||||
}
|
||||
|
||||
|
||||
|
||||
message PollEvent {
|
||||
|
||||
enum PollEventFlag {
|
||||
SOCKET_POLLNONE = 0;
|
||||
SOCKET_POLLIN = 1;
|
||||
SOCKET_POLLPRI = 2;
|
||||
SOCKET_POLLOUT = 4;
|
||||
SOCKET_POLLERR = 8;
|
||||
SOCKET_POLLHUP = 16;
|
||||
SOCKET_POLLNVAL = 32;
|
||||
SOCKET_POLLRDNORM = 64;
|
||||
SOCKET_POLLRDBAND = 128;
|
||||
SOCKET_POLLWRNORM = 256;
|
||||
SOCKET_POLLWRBAND = 512;
|
||||
SOCKET_POLLMSG = 1024;
|
||||
SOCKET_POLLREMOVE = 4096;
|
||||
SOCKET_POLLRDHUP = 8192;
|
||||
};
|
||||
|
||||
required string socket_descriptor = 1;
|
||||
required int32 requested_events = 2;
|
||||
required int32 observed_events = 3;
|
||||
}
|
||||
|
||||
message PollRequest {
|
||||
repeated PollEvent events = 1;
|
||||
optional double timeout_seconds = 2 [default=-1];
|
||||
}
|
||||
|
||||
message PollReply {
|
||||
repeated PollEvent events = 2;
|
||||
}
|
||||
|
||||
message ResolveRequest {
|
||||
required string name = 1;
|
||||
repeated CreateSocketRequest.SocketFamily address_families = 2;
|
||||
}
|
||||
|
||||
message ResolveReply {
|
||||
enum ErrorCode {
|
||||
SOCKET_EAI_ADDRFAMILY = 1;
|
||||
SOCKET_EAI_AGAIN = 2;
|
||||
SOCKET_EAI_BADFLAGS = 3;
|
||||
SOCKET_EAI_FAIL = 4;
|
||||
SOCKET_EAI_FAMILY = 5;
|
||||
SOCKET_EAI_MEMORY = 6;
|
||||
SOCKET_EAI_NODATA = 7;
|
||||
SOCKET_EAI_NONAME = 8;
|
||||
SOCKET_EAI_SERVICE = 9;
|
||||
SOCKET_EAI_SOCKTYPE = 10;
|
||||
SOCKET_EAI_SYSTEM = 11;
|
||||
SOCKET_EAI_BADHINTS = 12;
|
||||
SOCKET_EAI_PROTOCOL = 13;
|
||||
SOCKET_EAI_OVERFLOW = 14;
|
||||
SOCKET_EAI_MAX = 15;
|
||||
};
|
||||
|
||||
repeated bytes packed_address = 2;
|
||||
optional string canonical_name = 3;
|
||||
repeated string aliases = 4;
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// Copyright 2012 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by the Apache 2.0
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package socket provides outbound network sockets.
|
||||
//
|
||||
// This package is only required in the classic App Engine environment.
|
||||
// Applications running only in App Engine "flexible environment" should
|
||||
// use the standard library's net package.
|
||||
package socket
|
||||
+290
@@ -0,0 +1,290 @@
|
||||
// Copyright 2012 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by the Apache 2.0
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build appengine
|
||||
|
||||
package socket
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/appengine/internal"
|
||||
|
||||
pb "google.golang.org/appengine/internal/socket"
|
||||
)
|
||||
|
||||
// Dial connects to the address addr on the network protocol.
|
||||
// The address format is host:port, where host may be a hostname or an IP address.
|
||||
// Known protocols are "tcp" and "udp".
|
||||
// The returned connection satisfies net.Conn, and is valid while ctx is valid;
|
||||
// if the connection is to be used after ctx becomes invalid, invoke SetContext
|
||||
// with the new context.
|
||||
func Dial(ctx context.Context, protocol, addr string) (*Conn, error) {
|
||||
return DialTimeout(ctx, protocol, addr, 0)
|
||||
}
|
||||
|
||||
var ipFamilies = []pb.CreateSocketRequest_SocketFamily{
|
||||
pb.CreateSocketRequest_IPv4,
|
||||
pb.CreateSocketRequest_IPv6,
|
||||
}
|
||||
|
||||
// DialTimeout is like Dial but takes a timeout.
|
||||
// The timeout includes name resolution, if required.
|
||||
func DialTimeout(ctx context.Context, protocol, addr string, timeout time.Duration) (*Conn, error) {
|
||||
dialCtx := ctx // Used for dialing and name resolution, but not stored in the *Conn.
|
||||
if timeout > 0 {
|
||||
var cancel context.CancelFunc
|
||||
dialCtx, cancel = context.WithTimeout(ctx, timeout)
|
||||
defer cancel()
|
||||
}
|
||||
|
||||
host, portStr, err := net.SplitHostPort(addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
port, err := strconv.Atoi(portStr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("socket: bad port %q: %v", portStr, err)
|
||||
}
|
||||
|
||||
var prot pb.CreateSocketRequest_SocketProtocol
|
||||
switch protocol {
|
||||
case "tcp":
|
||||
prot = pb.CreateSocketRequest_TCP
|
||||
case "udp":
|
||||
prot = pb.CreateSocketRequest_UDP
|
||||
default:
|
||||
return nil, fmt.Errorf("socket: unknown protocol %q", protocol)
|
||||
}
|
||||
|
||||
packedAddrs, resolved, err := resolve(dialCtx, ipFamilies, host)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("socket: failed resolving %q: %v", host, err)
|
||||
}
|
||||
if len(packedAddrs) == 0 {
|
||||
return nil, fmt.Errorf("no addresses for %q", host)
|
||||
}
|
||||
|
||||
packedAddr := packedAddrs[0] // use first address
|
||||
fam := pb.CreateSocketRequest_IPv4
|
||||
if len(packedAddr) == net.IPv6len {
|
||||
fam = pb.CreateSocketRequest_IPv6
|
||||
}
|
||||
|
||||
req := &pb.CreateSocketRequest{
|
||||
Family: fam.Enum(),
|
||||
Protocol: prot.Enum(),
|
||||
RemoteIp: &pb.AddressPort{
|
||||
Port: proto.Int32(int32(port)),
|
||||
PackedAddress: packedAddr,
|
||||
},
|
||||
}
|
||||
if resolved {
|
||||
req.RemoteIp.HostnameHint = &host
|
||||
}
|
||||
res := &pb.CreateSocketReply{}
|
||||
if err := internal.Call(dialCtx, "remote_socket", "CreateSocket", req, res); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Conn{
|
||||
ctx: ctx,
|
||||
desc: res.GetSocketDescriptor(),
|
||||
prot: prot,
|
||||
local: res.ProxyExternalIp,
|
||||
remote: req.RemoteIp,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// LookupIP returns the given host's IP addresses.
|
||||
func LookupIP(ctx context.Context, host string) (addrs []net.IP, err error) {
|
||||
packedAddrs, _, err := resolve(ctx, ipFamilies, host)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("socket: failed resolving %q: %v", host, err)
|
||||
}
|
||||
addrs = make([]net.IP, len(packedAddrs))
|
||||
for i, pa := range packedAddrs {
|
||||
addrs[i] = net.IP(pa)
|
||||
}
|
||||
return addrs, nil
|
||||
}
|
||||
|
||||
func resolve(ctx context.Context, fams []pb.CreateSocketRequest_SocketFamily, host string) ([][]byte, bool, error) {
|
||||
// Check if it's an IP address.
|
||||
if ip := net.ParseIP(host); ip != nil {
|
||||
if ip := ip.To4(); ip != nil {
|
||||
return [][]byte{ip}, false, nil
|
||||
}
|
||||
return [][]byte{ip}, false, nil
|
||||
}
|
||||
|
||||
req := &pb.ResolveRequest{
|
||||
Name: &host,
|
||||
AddressFamilies: fams,
|
||||
}
|
||||
res := &pb.ResolveReply{}
|
||||
if err := internal.Call(ctx, "remote_socket", "Resolve", req, res); err != nil {
|
||||
// XXX: need to map to pb.ResolveReply_ErrorCode?
|
||||
return nil, false, err
|
||||
}
|
||||
return res.PackedAddress, true, nil
|
||||
}
|
||||
|
||||
// withDeadline is like context.WithDeadline, except it ignores the zero deadline.
|
||||
func withDeadline(parent context.Context, deadline time.Time) (context.Context, context.CancelFunc) {
|
||||
if deadline.IsZero() {
|
||||
return parent, func() {}
|
||||
}
|
||||
return context.WithDeadline(parent, deadline)
|
||||
}
|
||||
|
||||
// Conn represents a socket connection.
|
||||
// It implements net.Conn.
|
||||
type Conn struct {
|
||||
ctx context.Context
|
||||
desc string
|
||||
offset int64
|
||||
|
||||
prot pb.CreateSocketRequest_SocketProtocol
|
||||
local, remote *pb.AddressPort
|
||||
|
||||
readDeadline, writeDeadline time.Time // optional
|
||||
}
|
||||
|
||||
// SetContext sets the context that is used by this Conn.
|
||||
// It is usually used only when using a Conn that was created in a different context,
|
||||
// such as when a connection is created during a warmup request but used while
|
||||
// servicing a user request.
|
||||
func (cn *Conn) SetContext(ctx context.Context) {
|
||||
cn.ctx = ctx
|
||||
}
|
||||
|
||||
func (cn *Conn) Read(b []byte) (n int, err error) {
|
||||
const maxRead = 1 << 20
|
||||
if len(b) > maxRead {
|
||||
b = b[:maxRead]
|
||||
}
|
||||
|
||||
req := &pb.ReceiveRequest{
|
||||
SocketDescriptor: &cn.desc,
|
||||
DataSize: proto.Int32(int32(len(b))),
|
||||
}
|
||||
res := &pb.ReceiveReply{}
|
||||
if !cn.readDeadline.IsZero() {
|
||||
req.TimeoutSeconds = proto.Float64(cn.readDeadline.Sub(time.Now()).Seconds())
|
||||
}
|
||||
ctx, cancel := withDeadline(cn.ctx, cn.readDeadline)
|
||||
defer cancel()
|
||||
if err := internal.Call(ctx, "remote_socket", "Receive", req, res); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if len(res.Data) == 0 {
|
||||
return 0, io.EOF
|
||||
}
|
||||
if len(res.Data) > len(b) {
|
||||
return 0, fmt.Errorf("socket: internal error: read too much data: %d > %d", len(res.Data), len(b))
|
||||
}
|
||||
return copy(b, res.Data), nil
|
||||
}
|
||||
|
||||
func (cn *Conn) Write(b []byte) (n int, err error) {
|
||||
const lim = 1 << 20 // max per chunk
|
||||
|
||||
for n < len(b) {
|
||||
chunk := b[n:]
|
||||
if len(chunk) > lim {
|
||||
chunk = chunk[:lim]
|
||||
}
|
||||
|
||||
req := &pb.SendRequest{
|
||||
SocketDescriptor: &cn.desc,
|
||||
Data: chunk,
|
||||
StreamOffset: &cn.offset,
|
||||
}
|
||||
res := &pb.SendReply{}
|
||||
if !cn.writeDeadline.IsZero() {
|
||||
req.TimeoutSeconds = proto.Float64(cn.writeDeadline.Sub(time.Now()).Seconds())
|
||||
}
|
||||
ctx, cancel := withDeadline(cn.ctx, cn.writeDeadline)
|
||||
defer cancel()
|
||||
if err = internal.Call(ctx, "remote_socket", "Send", req, res); err != nil {
|
||||
// assume zero bytes were sent in this RPC
|
||||
break
|
||||
}
|
||||
n += int(res.GetDataSent())
|
||||
cn.offset += int64(res.GetDataSent())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (cn *Conn) Close() error {
|
||||
req := &pb.CloseRequest{
|
||||
SocketDescriptor: &cn.desc,
|
||||
}
|
||||
res := &pb.CloseReply{}
|
||||
if err := internal.Call(cn.ctx, "remote_socket", "Close", req, res); err != nil {
|
||||
return err
|
||||
}
|
||||
cn.desc = "CLOSED"
|
||||
return nil
|
||||
}
|
||||
|
||||
func addr(prot pb.CreateSocketRequest_SocketProtocol, ap *pb.AddressPort) net.Addr {
|
||||
if ap == nil {
|
||||
return nil
|
||||
}
|
||||
switch prot {
|
||||
case pb.CreateSocketRequest_TCP:
|
||||
return &net.TCPAddr{
|
||||
IP: net.IP(ap.PackedAddress),
|
||||
Port: int(*ap.Port),
|
||||
}
|
||||
case pb.CreateSocketRequest_UDP:
|
||||
return &net.UDPAddr{
|
||||
IP: net.IP(ap.PackedAddress),
|
||||
Port: int(*ap.Port),
|
||||
}
|
||||
}
|
||||
panic("unknown protocol " + prot.String())
|
||||
}
|
||||
|
||||
func (cn *Conn) LocalAddr() net.Addr { return addr(cn.prot, cn.local) }
|
||||
func (cn *Conn) RemoteAddr() net.Addr { return addr(cn.prot, cn.remote) }
|
||||
|
||||
func (cn *Conn) SetDeadline(t time.Time) error {
|
||||
cn.readDeadline = t
|
||||
cn.writeDeadline = t
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cn *Conn) SetReadDeadline(t time.Time) error {
|
||||
cn.readDeadline = t
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cn *Conn) SetWriteDeadline(t time.Time) error {
|
||||
cn.writeDeadline = t
|
||||
return nil
|
||||
}
|
||||
|
||||
// KeepAlive signals that the connection is still in use.
|
||||
// It may be called to prevent the socket being closed due to inactivity.
|
||||
func (cn *Conn) KeepAlive() error {
|
||||
req := &pb.GetSocketNameRequest{
|
||||
SocketDescriptor: &cn.desc,
|
||||
}
|
||||
res := &pb.GetSocketNameReply{}
|
||||
return internal.Call(cn.ctx, "remote_socket", "GetSocketName", req, res)
|
||||
}
|
||||
|
||||
func init() {
|
||||
internal.RegisterErrorCodeMap("remote_socket", pb.RemoteSocketServiceError_ErrorCode_name)
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
// Copyright 2015 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by the Apache 2.0
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !appengine
|
||||
|
||||
package socket
|
||||
|
||||
import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// Dial connects to the address addr on the network protocol.
|
||||
// The address format is host:port, where host may be a hostname or an IP address.
|
||||
// Known protocols are "tcp" and "udp".
|
||||
// The returned connection satisfies net.Conn, and is valid while ctx is valid;
|
||||
// if the connection is to be used after ctx becomes invalid, invoke SetContext
|
||||
// with the new context.
|
||||
func Dial(ctx context.Context, protocol, addr string) (*Conn, error) {
|
||||
conn, err := net.Dial(protocol, addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Conn{conn}, nil
|
||||
}
|
||||
|
||||
// DialTimeout is like Dial but takes a timeout.
|
||||
// The timeout includes name resolution, if required.
|
||||
func DialTimeout(ctx context.Context, protocol, addr string, timeout time.Duration) (*Conn, error) {
|
||||
conn, err := net.DialTimeout(protocol, addr, timeout)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Conn{conn}, nil
|
||||
}
|
||||
|
||||
// LookupIP returns the given host's IP addresses.
|
||||
func LookupIP(ctx context.Context, host string) (addrs []net.IP, err error) {
|
||||
return net.LookupIP(host)
|
||||
}
|
||||
|
||||
// Conn represents a socket connection.
|
||||
// It implements net.Conn.
|
||||
type Conn struct {
|
||||
net.Conn
|
||||
}
|
||||
|
||||
// SetContext sets the context that is used by this Conn.
|
||||
// It is usually used only when using a Conn that was created in a different context,
|
||||
// such as when a connection is created during a warmup request but used while
|
||||
// servicing a user request.
|
||||
func (cn *Conn) SetContext(ctx context.Context) {
|
||||
// This function is not required in App Engine "flexible environment".
|
||||
}
|
||||
|
||||
// KeepAlive signals that the connection is still in use.
|
||||
// It may be called to prevent the socket being closed due to inactivity.
|
||||
func (cn *Conn) KeepAlive() error {
|
||||
// This function is not required in App Engine "flexible environment".
|
||||
return nil
|
||||
}
|
||||
+626
@@ -0,0 +1,626 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/api/distribution.proto
|
||||
|
||||
package distribution // import "google.golang.org/genproto/googleapis/api/distribution"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
|
||||
// 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
|
||||
|
||||
// Distribution contains summary statistics for a population of values and,
|
||||
// optionally, a histogram representing the distribution of those values across
|
||||
// a specified set of histogram buckets.
|
||||
//
|
||||
// The summary statistics are the count, mean, sum of the squared deviation from
|
||||
// the mean, the minimum, and the maximum of the set of population of values.
|
||||
//
|
||||
// The histogram is based on a sequence of buckets and gives a count of values
|
||||
// that fall into each bucket. The boundaries of the buckets are given either
|
||||
// explicitly or by specifying parameters for a method of computing them
|
||||
// (buckets of fixed width or buckets of exponentially increasing width).
|
||||
//
|
||||
// Although it is not forbidden, it is generally a bad idea to include
|
||||
// non-finite values (infinities or NaNs) in the population of values, as this
|
||||
// will render the `mean` and `sum_of_squared_deviation` fields meaningless.
|
||||
type Distribution struct {
|
||||
// The number of values in the population. Must be non-negative.
|
||||
Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
|
||||
// The arithmetic mean of the values in the population. If `count` is zero
|
||||
// then this field must be zero.
|
||||
Mean float64 `protobuf:"fixed64,2,opt,name=mean,proto3" json:"mean,omitempty"`
|
||||
// The sum of squared deviations from the mean of the values in the
|
||||
// population. For values x_i this is:
|
||||
//
|
||||
// Sum[i=1..n]((x_i - mean)^2)
|
||||
//
|
||||
// Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition
|
||||
// describes Welford's method for accumulating this sum in one pass.
|
||||
//
|
||||
// If `count` is zero then this field must be zero.
|
||||
SumOfSquaredDeviation float64 `protobuf:"fixed64,3,opt,name=sum_of_squared_deviation,json=sumOfSquaredDeviation,proto3" json:"sum_of_squared_deviation,omitempty"`
|
||||
// If specified, contains the range of the population values. The field
|
||||
// must not be present if the `count` is zero.
|
||||
Range *Distribution_Range `protobuf:"bytes,4,opt,name=range,proto3" json:"range,omitempty"`
|
||||
// Defines the histogram bucket boundaries.
|
||||
BucketOptions *Distribution_BucketOptions `protobuf:"bytes,6,opt,name=bucket_options,json=bucketOptions,proto3" json:"bucket_options,omitempty"`
|
||||
// If `bucket_options` is given, then the sum of the values in `bucket_counts`
|
||||
// must equal the value in `count`. If `bucket_options` is not given, no
|
||||
// `bucket_counts` fields may be given.
|
||||
//
|
||||
// Bucket counts are given in order under the numbering scheme described
|
||||
// above (the underflow bucket has number 0; the finite buckets, if any,
|
||||
// have numbers 1 through N-2; the overflow bucket has number N-1).
|
||||
//
|
||||
// The size of `bucket_counts` must be no greater than N as defined in
|
||||
// `bucket_options`.
|
||||
//
|
||||
// Any suffix of trailing zero bucket_count fields may be omitted.
|
||||
BucketCounts []int64 `protobuf:"varint,7,rep,packed,name=bucket_counts,json=bucketCounts,proto3" json:"bucket_counts,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Distribution) Reset() { *m = Distribution{} }
|
||||
func (m *Distribution) String() string { return proto.CompactTextString(m) }
|
||||
func (*Distribution) ProtoMessage() {}
|
||||
func (*Distribution) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_distribution_4362d2d5f4dd1b54, []int{0}
|
||||
}
|
||||
func (m *Distribution) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Distribution.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Distribution) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Distribution.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Distribution) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Distribution.Merge(dst, src)
|
||||
}
|
||||
func (m *Distribution) XXX_Size() int {
|
||||
return xxx_messageInfo_Distribution.Size(m)
|
||||
}
|
||||
func (m *Distribution) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Distribution.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Distribution proto.InternalMessageInfo
|
||||
|
||||
func (m *Distribution) GetCount() int64 {
|
||||
if m != nil {
|
||||
return m.Count
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Distribution) GetMean() float64 {
|
||||
if m != nil {
|
||||
return m.Mean
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Distribution) GetSumOfSquaredDeviation() float64 {
|
||||
if m != nil {
|
||||
return m.SumOfSquaredDeviation
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Distribution) GetRange() *Distribution_Range {
|
||||
if m != nil {
|
||||
return m.Range
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Distribution) GetBucketOptions() *Distribution_BucketOptions {
|
||||
if m != nil {
|
||||
return m.BucketOptions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Distribution) GetBucketCounts() []int64 {
|
||||
if m != nil {
|
||||
return m.BucketCounts
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// The range of the population values.
|
||||
type Distribution_Range struct {
|
||||
// The minimum of the population values.
|
||||
Min float64 `protobuf:"fixed64,1,opt,name=min,proto3" json:"min,omitempty"`
|
||||
// The maximum of the population values.
|
||||
Max float64 `protobuf:"fixed64,2,opt,name=max,proto3" json:"max,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Distribution_Range) Reset() { *m = Distribution_Range{} }
|
||||
func (m *Distribution_Range) String() string { return proto.CompactTextString(m) }
|
||||
func (*Distribution_Range) ProtoMessage() {}
|
||||
func (*Distribution_Range) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_distribution_4362d2d5f4dd1b54, []int{0, 0}
|
||||
}
|
||||
func (m *Distribution_Range) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Distribution_Range.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Distribution_Range) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Distribution_Range.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Distribution_Range) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Distribution_Range.Merge(dst, src)
|
||||
}
|
||||
func (m *Distribution_Range) XXX_Size() int {
|
||||
return xxx_messageInfo_Distribution_Range.Size(m)
|
||||
}
|
||||
func (m *Distribution_Range) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Distribution_Range.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Distribution_Range proto.InternalMessageInfo
|
||||
|
||||
func (m *Distribution_Range) GetMin() float64 {
|
||||
if m != nil {
|
||||
return m.Min
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Distribution_Range) GetMax() float64 {
|
||||
if m != nil {
|
||||
return m.Max
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// A Distribution may optionally contain a histogram of the values in the
|
||||
// population. The histogram is given in `bucket_counts` as counts of values
|
||||
// that fall into one of a sequence of non-overlapping buckets. The sequence
|
||||
// of buckets is described by `bucket_options`.
|
||||
//
|
||||
// A bucket specifies an inclusive lower bound and exclusive upper bound for
|
||||
// the values that are counted for that bucket. The upper bound of a bucket
|
||||
// is strictly greater than the lower bound.
|
||||
//
|
||||
// The sequence of N buckets for a Distribution consists of an underflow
|
||||
// bucket (number 0), zero or more finite buckets (number 1 through N - 2) and
|
||||
// an overflow bucket (number N - 1). The buckets are contiguous: the lower
|
||||
// bound of bucket i (i > 0) is the same as the upper bound of bucket i - 1.
|
||||
// The buckets span the whole range of finite values: lower bound of the
|
||||
// underflow bucket is -infinity and the upper bound of the overflow bucket is
|
||||
// +infinity. The finite buckets are so-called because both bounds are
|
||||
// finite.
|
||||
//
|
||||
// `BucketOptions` describes bucket boundaries in one of three ways. Two
|
||||
// describe the boundaries by giving parameters for a formula to generate
|
||||
// boundaries and one gives the bucket boundaries explicitly.
|
||||
//
|
||||
// If `bucket_boundaries` is not given, then no `bucket_counts` may be given.
|
||||
type Distribution_BucketOptions struct {
|
||||
// Exactly one of these three fields must be set.
|
||||
//
|
||||
// Types that are valid to be assigned to Options:
|
||||
// *Distribution_BucketOptions_LinearBuckets
|
||||
// *Distribution_BucketOptions_ExponentialBuckets
|
||||
// *Distribution_BucketOptions_ExplicitBuckets
|
||||
Options isDistribution_BucketOptions_Options `protobuf_oneof:"options"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Distribution_BucketOptions) Reset() { *m = Distribution_BucketOptions{} }
|
||||
func (m *Distribution_BucketOptions) String() string { return proto.CompactTextString(m) }
|
||||
func (*Distribution_BucketOptions) ProtoMessage() {}
|
||||
func (*Distribution_BucketOptions) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_distribution_4362d2d5f4dd1b54, []int{0, 1}
|
||||
}
|
||||
func (m *Distribution_BucketOptions) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Distribution_BucketOptions.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Distribution_BucketOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Distribution_BucketOptions.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Distribution_BucketOptions) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Distribution_BucketOptions.Merge(dst, src)
|
||||
}
|
||||
func (m *Distribution_BucketOptions) XXX_Size() int {
|
||||
return xxx_messageInfo_Distribution_BucketOptions.Size(m)
|
||||
}
|
||||
func (m *Distribution_BucketOptions) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Distribution_BucketOptions.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Distribution_BucketOptions proto.InternalMessageInfo
|
||||
|
||||
type isDistribution_BucketOptions_Options interface {
|
||||
isDistribution_BucketOptions_Options()
|
||||
}
|
||||
|
||||
type Distribution_BucketOptions_LinearBuckets struct {
|
||||
LinearBuckets *Distribution_BucketOptions_Linear `protobuf:"bytes,1,opt,name=linear_buckets,json=linearBuckets,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Distribution_BucketOptions_ExponentialBuckets struct {
|
||||
ExponentialBuckets *Distribution_BucketOptions_Exponential `protobuf:"bytes,2,opt,name=exponential_buckets,json=exponentialBuckets,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Distribution_BucketOptions_ExplicitBuckets struct {
|
||||
ExplicitBuckets *Distribution_BucketOptions_Explicit `protobuf:"bytes,3,opt,name=explicit_buckets,json=explicitBuckets,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*Distribution_BucketOptions_LinearBuckets) isDistribution_BucketOptions_Options() {}
|
||||
|
||||
func (*Distribution_BucketOptions_ExponentialBuckets) isDistribution_BucketOptions_Options() {}
|
||||
|
||||
func (*Distribution_BucketOptions_ExplicitBuckets) isDistribution_BucketOptions_Options() {}
|
||||
|
||||
func (m *Distribution_BucketOptions) GetOptions() isDistribution_BucketOptions_Options {
|
||||
if m != nil {
|
||||
return m.Options
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Distribution_BucketOptions) GetLinearBuckets() *Distribution_BucketOptions_Linear {
|
||||
if x, ok := m.GetOptions().(*Distribution_BucketOptions_LinearBuckets); ok {
|
||||
return x.LinearBuckets
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Distribution_BucketOptions) GetExponentialBuckets() *Distribution_BucketOptions_Exponential {
|
||||
if x, ok := m.GetOptions().(*Distribution_BucketOptions_ExponentialBuckets); ok {
|
||||
return x.ExponentialBuckets
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Distribution_BucketOptions) GetExplicitBuckets() *Distribution_BucketOptions_Explicit {
|
||||
if x, ok := m.GetOptions().(*Distribution_BucketOptions_ExplicitBuckets); ok {
|
||||
return x.ExplicitBuckets
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*Distribution_BucketOptions) 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 _Distribution_BucketOptions_OneofMarshaler, _Distribution_BucketOptions_OneofUnmarshaler, _Distribution_BucketOptions_OneofSizer, []interface{}{
|
||||
(*Distribution_BucketOptions_LinearBuckets)(nil),
|
||||
(*Distribution_BucketOptions_ExponentialBuckets)(nil),
|
||||
(*Distribution_BucketOptions_ExplicitBuckets)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _Distribution_BucketOptions_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*Distribution_BucketOptions)
|
||||
// options
|
||||
switch x := m.Options.(type) {
|
||||
case *Distribution_BucketOptions_LinearBuckets:
|
||||
b.EncodeVarint(1<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.LinearBuckets); err != nil {
|
||||
return err
|
||||
}
|
||||
case *Distribution_BucketOptions_ExponentialBuckets:
|
||||
b.EncodeVarint(2<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.ExponentialBuckets); err != nil {
|
||||
return err
|
||||
}
|
||||
case *Distribution_BucketOptions_ExplicitBuckets:
|
||||
b.EncodeVarint(3<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.ExplicitBuckets); err != nil {
|
||||
return err
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("Distribution_BucketOptions.Options has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _Distribution_BucketOptions_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*Distribution_BucketOptions)
|
||||
switch tag {
|
||||
case 1: // options.linear_buckets
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(Distribution_BucketOptions_Linear)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Options = &Distribution_BucketOptions_LinearBuckets{msg}
|
||||
return true, err
|
||||
case 2: // options.exponential_buckets
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(Distribution_BucketOptions_Exponential)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Options = &Distribution_BucketOptions_ExponentialBuckets{msg}
|
||||
return true, err
|
||||
case 3: // options.explicit_buckets
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(Distribution_BucketOptions_Explicit)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Options = &Distribution_BucketOptions_ExplicitBuckets{msg}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _Distribution_BucketOptions_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*Distribution_BucketOptions)
|
||||
// options
|
||||
switch x := m.Options.(type) {
|
||||
case *Distribution_BucketOptions_LinearBuckets:
|
||||
s := proto.Size(x.LinearBuckets)
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *Distribution_BucketOptions_ExponentialBuckets:
|
||||
s := proto.Size(x.ExponentialBuckets)
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *Distribution_BucketOptions_ExplicitBuckets:
|
||||
s := proto.Size(x.ExplicitBuckets)
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// Specify a sequence of buckets that all have the same width (except
|
||||
// overflow and underflow). Each bucket represents a constant absolute
|
||||
// uncertainty on the specific value in the bucket.
|
||||
//
|
||||
// Defines `num_finite_buckets + 2` (= N) buckets with these boundaries for
|
||||
// bucket `i`:
|
||||
//
|
||||
// Upper bound (0 <= i < N-1): offset + (width * i).
|
||||
// Lower bound (1 <= i < N): offset + (width * (i - 1)).
|
||||
type Distribution_BucketOptions_Linear struct {
|
||||
// Must be greater than 0.
|
||||
NumFiniteBuckets int32 `protobuf:"varint,1,opt,name=num_finite_buckets,json=numFiniteBuckets,proto3" json:"num_finite_buckets,omitempty"`
|
||||
// Must be greater than 0.
|
||||
Width float64 `protobuf:"fixed64,2,opt,name=width,proto3" json:"width,omitempty"`
|
||||
// Lower bound of the first bucket.
|
||||
Offset float64 `protobuf:"fixed64,3,opt,name=offset,proto3" json:"offset,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Distribution_BucketOptions_Linear) Reset() { *m = Distribution_BucketOptions_Linear{} }
|
||||
func (m *Distribution_BucketOptions_Linear) String() string { return proto.CompactTextString(m) }
|
||||
func (*Distribution_BucketOptions_Linear) ProtoMessage() {}
|
||||
func (*Distribution_BucketOptions_Linear) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_distribution_4362d2d5f4dd1b54, []int{0, 1, 0}
|
||||
}
|
||||
func (m *Distribution_BucketOptions_Linear) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Distribution_BucketOptions_Linear.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Distribution_BucketOptions_Linear) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Distribution_BucketOptions_Linear.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Distribution_BucketOptions_Linear) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Distribution_BucketOptions_Linear.Merge(dst, src)
|
||||
}
|
||||
func (m *Distribution_BucketOptions_Linear) XXX_Size() int {
|
||||
return xxx_messageInfo_Distribution_BucketOptions_Linear.Size(m)
|
||||
}
|
||||
func (m *Distribution_BucketOptions_Linear) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Distribution_BucketOptions_Linear.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Distribution_BucketOptions_Linear proto.InternalMessageInfo
|
||||
|
||||
func (m *Distribution_BucketOptions_Linear) GetNumFiniteBuckets() int32 {
|
||||
if m != nil {
|
||||
return m.NumFiniteBuckets
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Distribution_BucketOptions_Linear) GetWidth() float64 {
|
||||
if m != nil {
|
||||
return m.Width
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Distribution_BucketOptions_Linear) GetOffset() float64 {
|
||||
if m != nil {
|
||||
return m.Offset
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// Specify a sequence of buckets that have a width that is proportional to
|
||||
// the value of the lower bound. Each bucket represents a constant relative
|
||||
// uncertainty on a specific value in the bucket.
|
||||
//
|
||||
// Defines `num_finite_buckets + 2` (= N) buckets with these boundaries for
|
||||
// bucket i:
|
||||
//
|
||||
// Upper bound (0 <= i < N-1): scale * (growth_factor ^ i).
|
||||
// Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)).
|
||||
type Distribution_BucketOptions_Exponential struct {
|
||||
// Must be greater than 0.
|
||||
NumFiniteBuckets int32 `protobuf:"varint,1,opt,name=num_finite_buckets,json=numFiniteBuckets,proto3" json:"num_finite_buckets,omitempty"`
|
||||
// Must be greater than 1.
|
||||
GrowthFactor float64 `protobuf:"fixed64,2,opt,name=growth_factor,json=growthFactor,proto3" json:"growth_factor,omitempty"`
|
||||
// Must be greater than 0.
|
||||
Scale float64 `protobuf:"fixed64,3,opt,name=scale,proto3" json:"scale,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Distribution_BucketOptions_Exponential) Reset() {
|
||||
*m = Distribution_BucketOptions_Exponential{}
|
||||
}
|
||||
func (m *Distribution_BucketOptions_Exponential) String() string { return proto.CompactTextString(m) }
|
||||
func (*Distribution_BucketOptions_Exponential) ProtoMessage() {}
|
||||
func (*Distribution_BucketOptions_Exponential) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_distribution_4362d2d5f4dd1b54, []int{0, 1, 1}
|
||||
}
|
||||
func (m *Distribution_BucketOptions_Exponential) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Distribution_BucketOptions_Exponential.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Distribution_BucketOptions_Exponential) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Distribution_BucketOptions_Exponential.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Distribution_BucketOptions_Exponential) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Distribution_BucketOptions_Exponential.Merge(dst, src)
|
||||
}
|
||||
func (m *Distribution_BucketOptions_Exponential) XXX_Size() int {
|
||||
return xxx_messageInfo_Distribution_BucketOptions_Exponential.Size(m)
|
||||
}
|
||||
func (m *Distribution_BucketOptions_Exponential) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Distribution_BucketOptions_Exponential.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Distribution_BucketOptions_Exponential proto.InternalMessageInfo
|
||||
|
||||
func (m *Distribution_BucketOptions_Exponential) GetNumFiniteBuckets() int32 {
|
||||
if m != nil {
|
||||
return m.NumFiniteBuckets
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Distribution_BucketOptions_Exponential) GetGrowthFactor() float64 {
|
||||
if m != nil {
|
||||
return m.GrowthFactor
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Distribution_BucketOptions_Exponential) GetScale() float64 {
|
||||
if m != nil {
|
||||
return m.Scale
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// A set of buckets with arbitrary widths.
|
||||
//
|
||||
// Defines `size(bounds) + 1` (= N) buckets with these boundaries for
|
||||
// bucket i:
|
||||
//
|
||||
// Upper bound (0 <= i < N-1): bounds[i]
|
||||
// Lower bound (1 <= i < N); bounds[i - 1]
|
||||
//
|
||||
// There must be at least one element in `bounds`. If `bounds` has only one
|
||||
// element, there are no finite buckets, and that single element is the
|
||||
// common boundary of the overflow and underflow buckets.
|
||||
type Distribution_BucketOptions_Explicit struct {
|
||||
// The values must be monotonically increasing.
|
||||
Bounds []float64 `protobuf:"fixed64,1,rep,packed,name=bounds,proto3" json:"bounds,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Distribution_BucketOptions_Explicit) Reset() { *m = Distribution_BucketOptions_Explicit{} }
|
||||
func (m *Distribution_BucketOptions_Explicit) String() string { return proto.CompactTextString(m) }
|
||||
func (*Distribution_BucketOptions_Explicit) ProtoMessage() {}
|
||||
func (*Distribution_BucketOptions_Explicit) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_distribution_4362d2d5f4dd1b54, []int{0, 1, 2}
|
||||
}
|
||||
func (m *Distribution_BucketOptions_Explicit) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Distribution_BucketOptions_Explicit.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Distribution_BucketOptions_Explicit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Distribution_BucketOptions_Explicit.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Distribution_BucketOptions_Explicit) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Distribution_BucketOptions_Explicit.Merge(dst, src)
|
||||
}
|
||||
func (m *Distribution_BucketOptions_Explicit) XXX_Size() int {
|
||||
return xxx_messageInfo_Distribution_BucketOptions_Explicit.Size(m)
|
||||
}
|
||||
func (m *Distribution_BucketOptions_Explicit) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Distribution_BucketOptions_Explicit.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Distribution_BucketOptions_Explicit proto.InternalMessageInfo
|
||||
|
||||
func (m *Distribution_BucketOptions_Explicit) GetBounds() []float64 {
|
||||
if m != nil {
|
||||
return m.Bounds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Distribution)(nil), "google.api.Distribution")
|
||||
proto.RegisterType((*Distribution_Range)(nil), "google.api.Distribution.Range")
|
||||
proto.RegisterType((*Distribution_BucketOptions)(nil), "google.api.Distribution.BucketOptions")
|
||||
proto.RegisterType((*Distribution_BucketOptions_Linear)(nil), "google.api.Distribution.BucketOptions.Linear")
|
||||
proto.RegisterType((*Distribution_BucketOptions_Exponential)(nil), "google.api.Distribution.BucketOptions.Exponential")
|
||||
proto.RegisterType((*Distribution_BucketOptions_Explicit)(nil), "google.api.Distribution.BucketOptions.Explicit")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google/api/distribution.proto", fileDescriptor_distribution_4362d2d5f4dd1b54)
|
||||
}
|
||||
|
||||
var fileDescriptor_distribution_4362d2d5f4dd1b54 = []byte{
|
||||
// 522 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x5d, 0x6b, 0xd4, 0x40,
|
||||
0x14, 0xdd, 0x34, 0xfb, 0xa1, 0x77, 0x3f, 0x5c, 0xc7, 0x2a, 0x21, 0xa8, 0x2c, 0x2d, 0xc8, 0x82,
|
||||
0x9a, 0x85, 0x55, 0xf0, 0xc1, 0xb7, 0x6d, 0x2d, 0xfb, 0xa0, 0xb4, 0x8c, 0xe0, 0x83, 0x08, 0x61,
|
||||
0x36, 0x99, 0xa4, 0xa3, 0xc9, 0x4c, 0xcc, 0x4c, 0xda, 0xfd, 0x01, 0xfe, 0x29, 0xff, 0x9d, 0xe4,
|
||||
0x4e, 0xb6, 0x4d, 0x11, 0x61, 0x7d, 0x9b, 0x73, 0xef, 0x99, 0x73, 0xce, 0xbd, 0x64, 0x02, 0xcf,
|
||||
0x52, 0xa5, 0xd2, 0x8c, 0x2f, 0x58, 0x21, 0x16, 0xb1, 0xd0, 0xa6, 0x14, 0x9b, 0xca, 0x08, 0x25,
|
||||
0x83, 0xa2, 0x54, 0x46, 0x11, 0xb0, 0xed, 0x80, 0x15, 0xc2, 0x7f, 0xda, 0xa2, 0x32, 0x29, 0x95,
|
||||
0x61, 0x35, 0x51, 0x5b, 0xe6, 0xd1, 0xaf, 0x01, 0x8c, 0x4e, 0x5b, 0x02, 0xe4, 0x10, 0x7a, 0x91,
|
||||
0xaa, 0xa4, 0xf1, 0x9c, 0x99, 0x33, 0x77, 0xa9, 0x05, 0x84, 0x40, 0x37, 0xe7, 0x4c, 0x7a, 0x07,
|
||||
0x33, 0x67, 0xee, 0x50, 0x3c, 0x93, 0x77, 0xe0, 0xe9, 0x2a, 0x0f, 0x55, 0x12, 0xea, 0x9f, 0x15,
|
||||
0x2b, 0x79, 0x1c, 0xc6, 0xfc, 0x4a, 0xa0, 0xba, 0xe7, 0x22, 0xef, 0xb1, 0xae, 0xf2, 0xf3, 0xe4,
|
||||
0xb3, 0xed, 0x9e, 0xee, 0x9a, 0xe4, 0x2d, 0xf4, 0x4a, 0x26, 0x53, 0xee, 0x75, 0x67, 0xce, 0x7c,
|
||||
0xb8, 0x7c, 0x1e, 0xdc, 0xa6, 0x0d, 0xda, 0x59, 0x02, 0x5a, 0xb3, 0xa8, 0x25, 0x93, 0x4f, 0x30,
|
||||
0xd9, 0x54, 0xd1, 0x0f, 0x6e, 0x42, 0x55, 0xe0, 0x04, 0x5e, 0x1f, 0xaf, 0xbf, 0xf8, 0xe7, 0xf5,
|
||||
0x15, 0xd2, 0xcf, 0x2d, 0x9b, 0x8e, 0x37, 0x6d, 0x48, 0x8e, 0xa1, 0x29, 0x84, 0x38, 0xa1, 0xf6,
|
||||
0x06, 0x33, 0x77, 0xee, 0xd2, 0x91, 0x2d, 0x9e, 0x60, 0xcd, 0x7f, 0x09, 0x3d, 0xcc, 0x40, 0xa6,
|
||||
0xe0, 0xe6, 0x42, 0xe2, 0x4e, 0x1c, 0x5a, 0x1f, 0xb1, 0xc2, 0xb6, 0xcd, 0x42, 0xea, 0xa3, 0xff,
|
||||
0xbb, 0x0b, 0xe3, 0x3b, 0x96, 0xe4, 0x0b, 0x4c, 0x32, 0x21, 0x39, 0x2b, 0x43, 0xab, 0xaa, 0x51,
|
||||
0x60, 0xb8, 0x7c, 0xbd, 0x5f, 0xe4, 0xe0, 0x23, 0x5e, 0x5e, 0x77, 0xe8, 0xd8, 0xca, 0xd8, 0xae,
|
||||
0x26, 0x1c, 0x1e, 0xf1, 0x6d, 0xa1, 0x24, 0x97, 0x46, 0xb0, 0xec, 0x46, 0xfc, 0x00, 0xc5, 0x97,
|
||||
0x7b, 0x8a, 0x7f, 0xb8, 0x55, 0x58, 0x77, 0x28, 0x69, 0x09, 0xee, 0x6c, 0xbe, 0xc1, 0x94, 0x6f,
|
||||
0x8b, 0x4c, 0x44, 0xc2, 0xdc, 0x78, 0xb8, 0xe8, 0xb1, 0xd8, 0xdf, 0x03, 0xaf, 0xaf, 0x3b, 0xf4,
|
||||
0xc1, 0x4e, 0xaa, 0x51, 0xf7, 0x63, 0xe8, 0xdb, 0xf9, 0xc8, 0x2b, 0x20, 0xb2, 0xca, 0xc3, 0x44,
|
||||
0x48, 0x61, 0xf8, 0x9d, 0x55, 0xf5, 0xe8, 0x54, 0x56, 0xf9, 0x19, 0x36, 0x76, 0xa9, 0x0e, 0xa1,
|
||||
0x77, 0x2d, 0x62, 0x73, 0xd9, 0xac, 0xde, 0x02, 0xf2, 0x04, 0xfa, 0x2a, 0x49, 0x34, 0x37, 0xcd,
|
||||
0xa7, 0xd7, 0x20, 0xff, 0x0a, 0x86, 0xad, 0x41, 0xff, 0xd3, 0xea, 0x18, 0xc6, 0x69, 0xa9, 0xae,
|
||||
0xcd, 0x65, 0x98, 0xb0, 0xc8, 0xa8, 0xb2, 0xb1, 0x1c, 0xd9, 0xe2, 0x19, 0xd6, 0xea, 0x3c, 0x3a,
|
||||
0x62, 0x19, 0x6f, 0x8c, 0x2d, 0xf0, 0x8f, 0xe0, 0xde, 0x6e, 0xf8, 0x3a, 0xdb, 0x46, 0x55, 0x32,
|
||||
0xae, 0x8d, 0xdc, 0x3a, 0x9b, 0x45, 0xab, 0xfb, 0x30, 0x68, 0x3e, 0xe5, 0xd5, 0x77, 0x98, 0x44,
|
||||
0x2a, 0x6f, 0x6d, 0x75, 0xf5, 0xb0, 0xbd, 0xd6, 0x8b, 0xfa, 0xad, 0x5e, 0x38, 0x5f, 0x4f, 0x1a,
|
||||
0x42, 0xaa, 0x32, 0x26, 0xd3, 0x40, 0x95, 0xe9, 0x22, 0xe5, 0x12, 0x5f, 0xf2, 0xc2, 0xb6, 0x58,
|
||||
0x21, 0xf4, 0x5f, 0x7f, 0x85, 0xf7, 0x6d, 0xb0, 0xe9, 0x23, 0xff, 0xcd, 0x9f, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0x62, 0xb4, 0xef, 0x6b, 0x44, 0x04, 0x00, 0x00,
|
||||
}
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/api/label.proto
|
||||
|
||||
package label // 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 fileDescriptor_label_7ab1ab74ef036f1c, []int{0, 0}
|
||||
}
|
||||
|
||||
// A description of a label.
|
||||
type LabelDescriptor struct {
|
||||
// The label key.
|
||||
Key string `protobuf:"bytes,1,opt,name=key,proto3" 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,proto3,enum=google.api.LabelDescriptor_ValueType" json:"value_type,omitempty"`
|
||||
// A human-readable description for the label.
|
||||
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *LabelDescriptor) Reset() { *m = LabelDescriptor{} }
|
||||
func (m *LabelDescriptor) String() string { return proto.CompactTextString(m) }
|
||||
func (*LabelDescriptor) ProtoMessage() {}
|
||||
func (*LabelDescriptor) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_label_7ab1ab74ef036f1c, []int{0}
|
||||
}
|
||||
func (m *LabelDescriptor) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_LabelDescriptor.Unmarshal(m, b)
|
||||
}
|
||||
func (m *LabelDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_LabelDescriptor.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *LabelDescriptor) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_LabelDescriptor.Merge(dst, src)
|
||||
}
|
||||
func (m *LabelDescriptor) XXX_Size() int {
|
||||
return xxx_messageInfo_LabelDescriptor.Size(m)
|
||||
}
|
||||
func (m *LabelDescriptor) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_LabelDescriptor.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_LabelDescriptor proto.InternalMessageInfo
|
||||
|
||||
func (m *LabelDescriptor) GetKey() string {
|
||||
if m != nil {
|
||||
return m.Key
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *LabelDescriptor) GetValueType() LabelDescriptor_ValueType {
|
||||
if m != nil {
|
||||
return m.ValueType
|
||||
}
|
||||
return LabelDescriptor_STRING
|
||||
}
|
||||
|
||||
func (m *LabelDescriptor) GetDescription() string {
|
||||
if m != nil {
|
||||
return m.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
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/api/label.proto", fileDescriptor_label_7ab1ab74ef036f1c) }
|
||||
|
||||
var fileDescriptor_label_7ab1ab74ef036f1c = []byte{
|
||||
// 252 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4b, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0x4f, 0x2c, 0xc8, 0xd4, 0xcf, 0x49, 0x4c, 0x4a, 0xcd, 0xd1, 0x2b, 0x28, 0xca,
|
||||
0x2f, 0xc9, 0x17, 0xe2, 0x82, 0x88, 0xeb, 0x25, 0x16, 0x64, 0x2a, 0xed, 0x64, 0xe4, 0xe2, 0xf7,
|
||||
0x01, 0xc9, 0xb9, 0xa4, 0x16, 0x27, 0x17, 0x65, 0x16, 0x94, 0xe4, 0x17, 0x09, 0x09, 0x70, 0x31,
|
||||
0x67, 0xa7, 0x56, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0x81, 0x98, 0x42, 0x2e, 0x5c, 0x5c,
|
||||
0x65, 0x89, 0x39, 0xa5, 0xa9, 0xf1, 0x25, 0x95, 0x05, 0xa9, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x7c,
|
||||
0x46, 0xaa, 0x7a, 0x08, 0x63, 0xf4, 0xd0, 0x8c, 0xd0, 0x0b, 0x03, 0xa9, 0x0e, 0xa9, 0x2c, 0x48,
|
||||
0x0d, 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, 0xc5, 0x73, 0xf1,
|
||||
0x25, 0xe7, 0xe7, 0x22, 0x39, 0xc3, 0x89, 0x0b, 0xec, 0x8e, 0x00, 0x90, 0x2f, 0x03, 0x18, 0xa3,
|
||||
0x4c, 0xa1, 0x32, 0xe9, 0xf9, 0x39, 0x89, 0x79, 0xe9, 0x7a, 0xf9, 0x45, 0xe9, 0xfa, 0xe9, 0xa9,
|
||||
0x79, 0xe0, 0x30, 0xd0, 0x87, 0x48, 0x25, 0x16, 0x64, 0x16, 0x23, 0x82, 0xc7, 0x1a, 0x4c, 0xfe,
|
||||
0x60, 0x64, 0x5c, 0xc4, 0xc4, 0xe2, 0xee, 0x18, 0xe0, 0x99, 0xc4, 0x06, 0x56, 0x6b, 0x0c, 0x08,
|
||||
0x00, 0x00, 0xff, 0xff, 0x57, 0x04, 0xaa, 0x1f, 0x49, 0x01, 0x00, 0x00,
|
||||
}
|
||||
+389
@@ -0,0 +1,389 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/api/metric.proto
|
||||
|
||||
package metric // import "google.golang.org/genproto/googleapis/api/metric"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import label "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 fileDescriptor_metric_18b95065d4b7f9c0, []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 fileDescriptor_metric_18b95065d4b7f9c0, []int{0, 1}
|
||||
}
|
||||
|
||||
// Defines a metric type and its schema. Once a metric descriptor is created,
|
||||
// deleting or altering it stops data collection and makes the metric type's
|
||||
// existing data unusable.
|
||||
type MetricDescriptor struct {
|
||||
// The resource name of the metric descriptor.
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// The metric type, including its DNS name prefix. The type is not
|
||||
// URL-encoded. All user-defined custom metric types have the DNS name
|
||||
// `custom.googleapis.com`. Metric types should use a natural hierarchical
|
||||
// grouping. For example:
|
||||
//
|
||||
// "custom.googleapis.com/invoice/paid/amount"
|
||||
// "appengine.googleapis.com/http/server/response_latencies"
|
||||
Type string `protobuf:"bytes,8,opt,name=type,proto3" json:"type,omitempty"`
|
||||
// The set of labels that can be used to describe a specific
|
||||
// instance of this metric type. For example, the
|
||||
// `appengine.googleapis.com/http/server/response_latencies` metric
|
||||
// type has a label for the HTTP response code, `response_code`, so
|
||||
// you can look at latencies for successful responses or just
|
||||
// for responses that failed.
|
||||
Labels []*label.LabelDescriptor `protobuf:"bytes,2,rep,name=labels,proto3" json:"labels,omitempty"`
|
||||
// Whether the metric records instantaneous values, changes to a value, etc.
|
||||
// Some combinations of `metric_kind` and `value_type` might not be supported.
|
||||
MetricKind MetricDescriptor_MetricKind `protobuf:"varint,3,opt,name=metric_kind,json=metricKind,proto3,enum=google.api.MetricDescriptor_MetricKind" json:"metric_kind,omitempty"`
|
||||
// Whether the measurement is an integer, a floating-point number, etc.
|
||||
// Some combinations of `metric_kind` and `value_type` might not be supported.
|
||||
ValueType MetricDescriptor_ValueType `protobuf:"varint,4,opt,name=value_type,json=valueType,proto3,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 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 '}'.
|
||||
// * `1` represents dimensionless value 1, such as in `1/s`.
|
||||
// * `%` represents dimensionless value 1/100, and annotates values giving
|
||||
// a percentage.
|
||||
Unit string `protobuf:"bytes,5,opt,name=unit,proto3" json:"unit,omitempty"`
|
||||
// A detailed description of the metric, which can be used in documentation.
|
||||
Description string `protobuf:"bytes,6,opt,name=description,proto3" 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".
|
||||
// This field is optional but it is recommended to be set for any metrics
|
||||
// associated with user-visible concepts, such as Quota.
|
||||
DisplayName string `protobuf:"bytes,7,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *MetricDescriptor) Reset() { *m = MetricDescriptor{} }
|
||||
func (m *MetricDescriptor) String() string { return proto.CompactTextString(m) }
|
||||
func (*MetricDescriptor) ProtoMessage() {}
|
||||
func (*MetricDescriptor) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_metric_18b95065d4b7f9c0, []int{0}
|
||||
}
|
||||
func (m *MetricDescriptor) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MetricDescriptor.Unmarshal(m, b)
|
||||
}
|
||||
func (m *MetricDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_MetricDescriptor.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *MetricDescriptor) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MetricDescriptor.Merge(dst, src)
|
||||
}
|
||||
func (m *MetricDescriptor) XXX_Size() int {
|
||||
return xxx_messageInfo_MetricDescriptor.Size(m)
|
||||
}
|
||||
func (m *MetricDescriptor) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MetricDescriptor.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MetricDescriptor proto.InternalMessageInfo
|
||||
|
||||
func (m *MetricDescriptor) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MetricDescriptor) GetType() string {
|
||||
if m != nil {
|
||||
return m.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MetricDescriptor) GetLabels() []*label.LabelDescriptor {
|
||||
if m != nil {
|
||||
return m.Labels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MetricDescriptor) GetMetricKind() MetricDescriptor_MetricKind {
|
||||
if m != nil {
|
||||
return m.MetricKind
|
||||
}
|
||||
return MetricDescriptor_METRIC_KIND_UNSPECIFIED
|
||||
}
|
||||
|
||||
func (m *MetricDescriptor) GetValueType() MetricDescriptor_ValueType {
|
||||
if m != nil {
|
||||
return m.ValueType
|
||||
}
|
||||
return MetricDescriptor_VALUE_TYPE_UNSPECIFIED
|
||||
}
|
||||
|
||||
func (m *MetricDescriptor) GetUnit() string {
|
||||
if m != nil {
|
||||
return m.Unit
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MetricDescriptor) GetDescription() string {
|
||||
if m != nil {
|
||||
return m.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MetricDescriptor) GetDisplayName() string {
|
||||
if m != nil {
|
||||
return m.DisplayName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// 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, `custom.googleapis.com/invoice/paid/amount`.
|
||||
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
|
||||
// The set of label values that uniquely identify this metric. All
|
||||
// labels listed in the `MetricDescriptor` must be assigned values.
|
||||
Labels map[string]string `protobuf:"bytes,2,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Metric) Reset() { *m = Metric{} }
|
||||
func (m *Metric) String() string { return proto.CompactTextString(m) }
|
||||
func (*Metric) ProtoMessage() {}
|
||||
func (*Metric) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_metric_18b95065d4b7f9c0, []int{1}
|
||||
}
|
||||
func (m *Metric) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Metric.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Metric) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Metric.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Metric) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Metric.Merge(dst, src)
|
||||
}
|
||||
func (m *Metric) XXX_Size() int {
|
||||
return xxx_messageInfo_Metric.Size(m)
|
||||
}
|
||||
func (m *Metric) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Metric.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Metric proto.InternalMessageInfo
|
||||
|
||||
func (m *Metric) GetType() string {
|
||||
if m != nil {
|
||||
return m.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
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.RegisterMapType((map[string]string)(nil), "google.api.Metric.LabelsEntry")
|
||||
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/api/metric.proto", fileDescriptor_metric_18b95065d4b7f9c0) }
|
||||
|
||||
var fileDescriptor_metric_18b95065d4b7f9c0 = []byte{
|
||||
// 506 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0x4d, 0x6f, 0xda, 0x40,
|
||||
0x10, 0xad, 0x3f, 0x70, 0xc3, 0x10, 0xa1, 0xd5, 0xaa, 0x4a, 0x2c, 0x22, 0x55, 0x94, 0x43, 0xcb,
|
||||
0x09, 0xa4, 0xa4, 0x4a, 0xbf, 0x4e, 0x80, 0xb7, 0xd4, 0x8a, 0xb1, 0x91, 0x63, 0x23, 0xa5, 0x17,
|
||||
0xcb, 0x81, 0x95, 0x65, 0xc5, 0xd8, 0xae, 0x71, 0x22, 0xf9, 0x57, 0xf4, 0x17, 0xf4, 0xd2, 0x5f,
|
||||
0x5a, 0xed, 0xae, 0x03, 0x16, 0x95, 0x72, 0xe2, 0xed, 0x9b, 0x37, 0x6f, 0x67, 0x96, 0x67, 0x38,
|
||||
0x8f, 0xb2, 0x2c, 0x4a, 0xe8, 0x38, 0xcc, 0xe3, 0xf1, 0x96, 0x96, 0x45, 0xbc, 0x1e, 0xe5, 0x45,
|
||||
0x56, 0x66, 0x18, 0x44, 0x61, 0x14, 0xe6, 0x71, 0xef, 0xac, 0x21, 0x4a, 0xc2, 0x7b, 0x9a, 0x08,
|
||||
0xcd, 0xe0, 0x8f, 0x0a, 0x68, 0xc1, 0x9b, 0x0c, 0xba, 0x5b, 0x17, 0x71, 0x5e, 0x66, 0x05, 0xc6,
|
||||
0xa0, 0xa6, 0xe1, 0x96, 0xea, 0x52, 0x5f, 0x1a, 0xb6, 0x5d, 0x8e, 0x19, 0x57, 0x56, 0x39, 0xd5,
|
||||
0x4f, 0x04, 0xc7, 0x30, 0xbe, 0x02, 0x8d, 0x7b, 0xed, 0x74, 0xb9, 0xaf, 0x0c, 0x3b, 0x97, 0x17,
|
||||
0xa3, 0xc3, 0x8d, 0x23, 0x8b, 0x55, 0x0e, 0xa6, 0x6e, 0x2d, 0xc5, 0x3f, 0xa0, 0x23, 0xa6, 0x0c,
|
||||
0x1e, 0xe2, 0x74, 0xa3, 0x2b, 0x7d, 0x69, 0xd8, 0xbd, 0xfc, 0xd0, 0xec, 0x3c, 0x9e, 0xa7, 0x26,
|
||||
0x6e, 0xe2, 0x74, 0xe3, 0xc2, 0x76, 0x8f, 0x31, 0x01, 0x78, 0x0a, 0x93, 0x47, 0x1a, 0xf0, 0xc1,
|
||||
0x54, 0x6e, 0xf4, 0xfe, 0x45, 0xa3, 0x15, 0x93, 0x7b, 0x55, 0x4e, 0xdd, 0xf6, 0xd3, 0x33, 0x64,
|
||||
0x9b, 0x3d, 0xa6, 0x71, 0xa9, 0xb7, 0xc4, 0x66, 0x0c, 0xe3, 0x3e, 0x74, 0x36, 0x75, 0x5b, 0x9c,
|
||||
0xa5, 0xba, 0xc6, 0x4b, 0x4d, 0x0a, 0xbf, 0x83, 0xd3, 0x4d, 0xbc, 0xcb, 0x93, 0xb0, 0x0a, 0xf8,
|
||||
0x5b, 0xbd, 0xae, 0x25, 0x82, 0xb3, 0xc3, 0x2d, 0x1d, 0x38, 0x00, 0x87, 0xc9, 0xf1, 0x05, 0x9c,
|
||||
0x2f, 0x88, 0xe7, 0x9a, 0xb3, 0xe0, 0xc6, 0xb4, 0x8d, 0xc0, 0xb7, 0x6f, 0x97, 0x64, 0x66, 0x7e,
|
||||
0x37, 0x89, 0x81, 0x5e, 0xe1, 0x36, 0xb4, 0xe6, 0x13, 0x7f, 0x4e, 0x90, 0xc4, 0xa0, 0x41, 0x2c,
|
||||
0x6f, 0x82, 0x64, 0xdc, 0x05, 0x98, 0xf9, 0x0b, 0xdf, 0x9a, 0x78, 0xe6, 0x8a, 0x20, 0x65, 0xf0,
|
||||
0x0b, 0xda, 0xfb, 0x0d, 0x70, 0x0f, 0xce, 0x56, 0x13, 0xcb, 0x27, 0x81, 0x77, 0xb7, 0x24, 0x47,
|
||||
0x76, 0x27, 0xa0, 0x4e, 0x1d, 0xc7, 0x12, 0x6e, 0xa6, 0xed, 0x5d, 0x7f, 0x44, 0x32, 0x06, 0xd0,
|
||||
0x0c, 0xc7, 0x9f, 0x5a, 0x04, 0x29, 0x0c, 0xdf, 0x7a, 0xae, 0x69, 0xcf, 0x91, 0x8a, 0x11, 0x9c,
|
||||
0x1a, 0x26, 0x3b, 0x4d, 0x7d, 0xcf, 0x74, 0x6c, 0xd4, 0x62, 0x4d, 0x0b, 0xc7, 0x26, 0x77, 0x48,
|
||||
0x1b, 0xfc, 0x96, 0x40, 0x13, 0x4b, 0xec, 0x13, 0xa0, 0x34, 0x12, 0x70, 0x7d, 0x94, 0x80, 0xb7,
|
||||
0xff, 0x3f, 0xbf, 0x08, 0xc2, 0x8e, 0xa4, 0x65, 0x51, 0x3d, 0x87, 0xa0, 0xf7, 0x05, 0x3a, 0x0d,
|
||||
0x1a, 0x23, 0x50, 0x1e, 0x68, 0x55, 0xe7, 0x8d, 0x41, 0xfc, 0x06, 0x5a, 0xfc, 0x1f, 0xd2, 0x65,
|
||||
0xce, 0x89, 0xc3, 0x57, 0xf9, 0xb3, 0x34, 0x0d, 0xa0, 0xbb, 0xce, 0xb6, 0x8d, 0x7b, 0xa6, 0x1d,
|
||||
0x71, 0xd1, 0x92, 0x05, 0x7a, 0x29, 0xfd, 0xfc, 0x54, 0x97, 0xa2, 0x2c, 0x09, 0xd3, 0x68, 0x94,
|
||||
0x15, 0xd1, 0x38, 0xa2, 0x29, 0x8f, 0xfb, 0x58, 0x94, 0xc2, 0x3c, 0xde, 0x35, 0x3e, 0x97, 0x6f,
|
||||
0xe2, 0xe7, 0xaf, 0xac, 0xce, 0x27, 0x4b, 0xf3, 0x5e, 0xe3, 0xd2, 0xab, 0x7f, 0x01, 0x00, 0x00,
|
||||
0xff, 0xff, 0x18, 0x04, 0x05, 0x82, 0x58, 0x03, 0x00, 0x00,
|
||||
}
|
||||
Generated
Vendored
+289
@@ -0,0 +1,289 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/api/monitored_resource.proto
|
||||
|
||||
package monitoredres // import "google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _struct "github.com/golang/protobuf/ptypes/struct"
|
||||
import label "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,proto3" 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,proto3" 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,proto3" 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,proto3" 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 []*label.LabelDescriptor `protobuf:"bytes,4,rep,name=labels,proto3" json:"labels,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *MonitoredResourceDescriptor) Reset() { *m = MonitoredResourceDescriptor{} }
|
||||
func (m *MonitoredResourceDescriptor) String() string { return proto.CompactTextString(m) }
|
||||
func (*MonitoredResourceDescriptor) ProtoMessage() {}
|
||||
func (*MonitoredResourceDescriptor) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_monitored_resource_35ee91132be0d9ce, []int{0}
|
||||
}
|
||||
func (m *MonitoredResourceDescriptor) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MonitoredResourceDescriptor.Unmarshal(m, b)
|
||||
}
|
||||
func (m *MonitoredResourceDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_MonitoredResourceDescriptor.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *MonitoredResourceDescriptor) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MonitoredResourceDescriptor.Merge(dst, src)
|
||||
}
|
||||
func (m *MonitoredResourceDescriptor) XXX_Size() int {
|
||||
return xxx_messageInfo_MonitoredResourceDescriptor.Size(m)
|
||||
}
|
||||
func (m *MonitoredResourceDescriptor) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MonitoredResourceDescriptor.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MonitoredResourceDescriptor proto.InternalMessageInfo
|
||||
|
||||
func (m *MonitoredResourceDescriptor) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MonitoredResourceDescriptor) GetType() string {
|
||||
if m != nil {
|
||||
return m.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MonitoredResourceDescriptor) GetDisplayName() string {
|
||||
if m != nil {
|
||||
return m.DisplayName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MonitoredResourceDescriptor) GetDescription() string {
|
||||
if m != nil {
|
||||
return m.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MonitoredResourceDescriptor) GetLabels() []*label.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 Compute Engine VM instance is `gce_instance`.
|
||||
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
|
||||
// Required. Values for all of the labels listed in the associated monitored
|
||||
// resource descriptor. For example, Compute Engine VM instances use the
|
||||
// labels `"project_id"`, `"instance_id"`, and `"zone"`.
|
||||
Labels map[string]string `protobuf:"bytes,2,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *MonitoredResource) Reset() { *m = MonitoredResource{} }
|
||||
func (m *MonitoredResource) String() string { return proto.CompactTextString(m) }
|
||||
func (*MonitoredResource) ProtoMessage() {}
|
||||
func (*MonitoredResource) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_monitored_resource_35ee91132be0d9ce, []int{1}
|
||||
}
|
||||
func (m *MonitoredResource) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MonitoredResource.Unmarshal(m, b)
|
||||
}
|
||||
func (m *MonitoredResource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_MonitoredResource.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *MonitoredResource) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MonitoredResource.Merge(dst, src)
|
||||
}
|
||||
func (m *MonitoredResource) XXX_Size() int {
|
||||
return xxx_messageInfo_MonitoredResource.Size(m)
|
||||
}
|
||||
func (m *MonitoredResource) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MonitoredResource.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MonitoredResource proto.InternalMessageInfo
|
||||
|
||||
func (m *MonitoredResource) GetType() string {
|
||||
if m != nil {
|
||||
return m.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MonitoredResource) GetLabels() map[string]string {
|
||||
if m != nil {
|
||||
return m.Labels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource] object.
|
||||
// [MonitoredResource][google.api.MonitoredResource] objects contain the minimum set of information to
|
||||
// uniquely identify a monitored resource instance. There is some other useful
|
||||
// auxiliary metadata. Google Stackdriver Monitoring & Logging uses an ingestion
|
||||
// pipeline to extract metadata for cloud resources of all types , and stores
|
||||
// the metadata in this message.
|
||||
type MonitoredResourceMetadata struct {
|
||||
// Output only. Values for predefined system metadata labels.
|
||||
// System labels are a kind of metadata extracted by Google Stackdriver.
|
||||
// Stackdriver determines what system labels are useful and how to obtain
|
||||
// their values. Some examples: "machine_image", "vpc", "subnet_id",
|
||||
// "security_group", "name", etc.
|
||||
// System label values can be only strings, Boolean values, or a list of
|
||||
// strings. For example:
|
||||
//
|
||||
// { "name": "my-test-instance",
|
||||
// "security_group": ["a", "b", "c"],
|
||||
// "spot_instance": false }
|
||||
SystemLabels *_struct.Struct `protobuf:"bytes,1,opt,name=system_labels,json=systemLabels,proto3" json:"system_labels,omitempty"`
|
||||
// Output only. A map of user-defined metadata labels.
|
||||
UserLabels map[string]string `protobuf:"bytes,2,rep,name=user_labels,json=userLabels,proto3" json:"user_labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *MonitoredResourceMetadata) Reset() { *m = MonitoredResourceMetadata{} }
|
||||
func (m *MonitoredResourceMetadata) String() string { return proto.CompactTextString(m) }
|
||||
func (*MonitoredResourceMetadata) ProtoMessage() {}
|
||||
func (*MonitoredResourceMetadata) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_monitored_resource_35ee91132be0d9ce, []int{2}
|
||||
}
|
||||
func (m *MonitoredResourceMetadata) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MonitoredResourceMetadata.Unmarshal(m, b)
|
||||
}
|
||||
func (m *MonitoredResourceMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_MonitoredResourceMetadata.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *MonitoredResourceMetadata) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MonitoredResourceMetadata.Merge(dst, src)
|
||||
}
|
||||
func (m *MonitoredResourceMetadata) XXX_Size() int {
|
||||
return xxx_messageInfo_MonitoredResourceMetadata.Size(m)
|
||||
}
|
||||
func (m *MonitoredResourceMetadata) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MonitoredResourceMetadata.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MonitoredResourceMetadata proto.InternalMessageInfo
|
||||
|
||||
func (m *MonitoredResourceMetadata) GetSystemLabels() *_struct.Struct {
|
||||
if m != nil {
|
||||
return m.SystemLabels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MonitoredResourceMetadata) GetUserLabels() map[string]string {
|
||||
if m != nil {
|
||||
return m.UserLabels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MonitoredResourceDescriptor)(nil), "google.api.MonitoredResourceDescriptor")
|
||||
proto.RegisterType((*MonitoredResource)(nil), "google.api.MonitoredResource")
|
||||
proto.RegisterMapType((map[string]string)(nil), "google.api.MonitoredResource.LabelsEntry")
|
||||
proto.RegisterType((*MonitoredResourceMetadata)(nil), "google.api.MonitoredResourceMetadata")
|
||||
proto.RegisterMapType((map[string]string)(nil), "google.api.MonitoredResourceMetadata.UserLabelsEntry")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google/api/monitored_resource.proto", fileDescriptor_monitored_resource_35ee91132be0d9ce)
|
||||
}
|
||||
|
||||
var fileDescriptor_monitored_resource_35ee91132be0d9ce = []byte{
|
||||
// 415 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x4d, 0xab, 0xd3, 0x40,
|
||||
0x14, 0x65, 0xd2, 0x0f, 0xf0, 0xa6, 0x7e, 0x0d, 0x52, 0x63, 0xea, 0xa2, 0xd6, 0x4d, 0xdd, 0x24,
|
||||
0xd0, 0x22, 0xf8, 0xb9, 0x68, 0x55, 0x44, 0xb0, 0x52, 0x22, 0xba, 0x70, 0x13, 0xa6, 0xc9, 0x18,
|
||||
0x82, 0x49, 0x26, 0xcc, 0x4c, 0x84, 0xfc, 0x1d, 0xc1, 0xdf, 0xe1, 0x5f, 0x72, 0xe9, 0x52, 0x32,
|
||||
0x33, 0x69, 0xd3, 0x97, 0xc7, 0x83, 0xb7, 0xbb, 0xf7, 0xdc, 0x73, 0xcf, 0x3d, 0x27, 0x43, 0xe0,
|
||||
0x71, 0xc2, 0x58, 0x92, 0x51, 0x9f, 0x94, 0xa9, 0x9f, 0xb3, 0x22, 0x95, 0x8c, 0xd3, 0x38, 0xe4,
|
||||
0x54, 0xb0, 0x8a, 0x47, 0xd4, 0x2b, 0x39, 0x93, 0x0c, 0x83, 0x26, 0x79, 0xa4, 0x4c, 0xdd, 0x69,
|
||||
0x67, 0x21, 0x23, 0x07, 0x9a, 0x69, 0x8e, 0xfb, 0xd0, 0xe0, 0xaa, 0x3b, 0x54, 0xdf, 0x7d, 0x21,
|
||||
0x79, 0x15, 0x49, 0x3d, 0x5d, 0xfc, 0x41, 0x30, 0xdb, 0xb5, 0xf2, 0x81, 0x51, 0x7f, 0x4b, 0x45,
|
||||
0xc4, 0xd3, 0x52, 0x32, 0x8e, 0x31, 0x0c, 0x0b, 0x92, 0x53, 0x67, 0x34, 0x47, 0xcb, 0x1b, 0x81,
|
||||
0xaa, 0x1b, 0x4c, 0xd6, 0x25, 0x75, 0x90, 0xc6, 0x9a, 0x1a, 0x3f, 0x82, 0x49, 0x9c, 0x8a, 0x32,
|
||||
0x23, 0x75, 0xa8, 0xf8, 0x96, 0x9a, 0xd9, 0x06, 0xfb, 0xd4, 0xac, 0xcd, 0xc1, 0x8e, 0x8d, 0x70,
|
||||
0xca, 0x0a, 0x67, 0x60, 0x18, 0x27, 0x08, 0xaf, 0x61, 0xac, 0x9c, 0x0b, 0x67, 0x38, 0x1f, 0x2c,
|
||||
0xed, 0xd5, 0xcc, 0x3b, 0xe5, 0xf3, 0x3e, 0x36, 0x93, 0x93, 0xb3, 0xc0, 0x50, 0x17, 0xbf, 0x11,
|
||||
0xdc, 0xed, 0x25, 0xb8, 0xd4, 0xe3, 0xe6, 0x28, 0x6f, 0x29, 0xf9, 0x27, 0x5d, 0xf9, 0x9e, 0x84,
|
||||
0x3e, 0x28, 0xde, 0x15, 0x92, 0xd7, 0xed, 0x31, 0xf7, 0x39, 0xd8, 0x1d, 0x18, 0xdf, 0x81, 0xc1,
|
||||
0x0f, 0x5a, 0x9b, 0x23, 0x4d, 0x89, 0xef, 0xc1, 0xe8, 0x27, 0xc9, 0xaa, 0xf6, 0x03, 0xe8, 0xe6,
|
||||
0x85, 0xf5, 0x0c, 0x2d, 0xfe, 0x22, 0x78, 0xd0, 0x3b, 0xb2, 0xa3, 0x92, 0xc4, 0x44, 0x12, 0xfc,
|
||||
0x0a, 0x6e, 0x8a, 0x5a, 0x48, 0x9a, 0x87, 0xc6, 0x62, 0xa3, 0x69, 0xaf, 0xee, 0xb7, 0x16, 0xdb,
|
||||
0xd7, 0xf3, 0x3e, 0xab, 0xd7, 0x0b, 0x26, 0x9a, 0xad, 0xcd, 0xe0, 0xaf, 0x60, 0x57, 0x82, 0xf2,
|
||||
0xf0, 0x2c, 0xde, 0xd3, 0x2b, 0xe3, 0xb5, 0x97, 0xbd, 0x2f, 0x82, 0xf2, 0x6e, 0x54, 0xa8, 0x8e,
|
||||
0x80, 0xfb, 0x1a, 0x6e, 0x5f, 0x18, 0x5f, 0x27, 0xf2, 0xb6, 0x86, 0x5b, 0x11, 0xcb, 0x3b, 0x36,
|
||||
0xb6, 0xd3, 0x9e, 0x8f, 0x7d, 0x13, 0x6c, 0x8f, 0xbe, 0xbd, 0x31, 0xac, 0x84, 0x65, 0xa4, 0x48,
|
||||
0x3c, 0xc6, 0x13, 0x3f, 0xa1, 0x85, 0x8a, 0xed, 0xeb, 0x11, 0x29, 0x53, 0x71, 0xfe, 0x3b, 0x70,
|
||||
0x2a, 0x5e, 0x76, 0x9b, 0x7f, 0x08, 0xfd, 0xb2, 0x86, 0xef, 0x37, 0xfb, 0x0f, 0x87, 0xb1, 0xda,
|
||||
0x5c, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x10, 0x16, 0x7c, 0xe9, 0x47, 0x03, 0x00, 0x00,
|
||||
}
|
||||
+1391
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+227
@@ -0,0 +1,227 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/devtools/cloudtrace/v2/tracing.proto
|
||||
|
||||
package cloudtrace // import "google.golang.org/genproto/googleapis/devtools/cloudtrace/v2"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import empty "github.com/golang/protobuf/ptypes/empty"
|
||||
import _ "github.com/golang/protobuf/ptypes/timestamp"
|
||||
import _ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
|
||||
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
|
||||
|
||||
// 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 request message for the `BatchWriteSpans` method.
|
||||
type BatchWriteSpansRequest struct {
|
||||
// Required. The name of the project where the spans belong. The format is
|
||||
// `projects/[PROJECT_ID]`.
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// A list of new spans. The span names must not match existing
|
||||
// spans, or the results are undefined.
|
||||
Spans []*Span `protobuf:"bytes,2,rep,name=spans,proto3" json:"spans,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *BatchWriteSpansRequest) Reset() { *m = BatchWriteSpansRequest{} }
|
||||
func (m *BatchWriteSpansRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*BatchWriteSpansRequest) ProtoMessage() {}
|
||||
func (*BatchWriteSpansRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_tracing_18786c49399bd83d, []int{0}
|
||||
}
|
||||
func (m *BatchWriteSpansRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_BatchWriteSpansRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *BatchWriteSpansRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_BatchWriteSpansRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *BatchWriteSpansRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_BatchWriteSpansRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *BatchWriteSpansRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_BatchWriteSpansRequest.Size(m)
|
||||
}
|
||||
func (m *BatchWriteSpansRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_BatchWriteSpansRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_BatchWriteSpansRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *BatchWriteSpansRequest) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *BatchWriteSpansRequest) GetSpans() []*Span {
|
||||
if m != nil {
|
||||
return m.Spans
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*BatchWriteSpansRequest)(nil), "google.devtools.cloudtrace.v2.BatchWriteSpansRequest")
|
||||
}
|
||||
|
||||
// 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.SupportPackageIsVersion4
|
||||
|
||||
// TraceServiceClient is the client API for TraceService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type TraceServiceClient interface {
|
||||
// Sends new spans to new or existing traces. You cannot update
|
||||
// existing spans.
|
||||
BatchWriteSpans(ctx context.Context, in *BatchWriteSpansRequest, opts ...grpc.CallOption) (*empty.Empty, error)
|
||||
// Creates a new span.
|
||||
CreateSpan(ctx context.Context, in *Span, opts ...grpc.CallOption) (*Span, error)
|
||||
}
|
||||
|
||||
type traceServiceClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewTraceServiceClient(cc *grpc.ClientConn) TraceServiceClient {
|
||||
return &traceServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *traceServiceClient) BatchWriteSpans(ctx context.Context, in *BatchWriteSpansRequest, opts ...grpc.CallOption) (*empty.Empty, error) {
|
||||
out := new(empty.Empty)
|
||||
err := c.cc.Invoke(ctx, "/google.devtools.cloudtrace.v2.TraceService/BatchWriteSpans", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *traceServiceClient) CreateSpan(ctx context.Context, in *Span, opts ...grpc.CallOption) (*Span, error) {
|
||||
out := new(Span)
|
||||
err := c.cc.Invoke(ctx, "/google.devtools.cloudtrace.v2.TraceService/CreateSpan", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// TraceServiceServer is the server API for TraceService service.
|
||||
type TraceServiceServer interface {
|
||||
// Sends new spans to new or existing traces. You cannot update
|
||||
// existing spans.
|
||||
BatchWriteSpans(context.Context, *BatchWriteSpansRequest) (*empty.Empty, error)
|
||||
// Creates a new span.
|
||||
CreateSpan(context.Context, *Span) (*Span, error)
|
||||
}
|
||||
|
||||
func RegisterTraceServiceServer(s *grpc.Server, srv TraceServiceServer) {
|
||||
s.RegisterService(&_TraceService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _TraceService_BatchWriteSpans_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(BatchWriteSpansRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TraceServiceServer).BatchWriteSpans(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.devtools.cloudtrace.v2.TraceService/BatchWriteSpans",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TraceServiceServer).BatchWriteSpans(ctx, req.(*BatchWriteSpansRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _TraceService_CreateSpan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(Span)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TraceServiceServer).CreateSpan(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.devtools.cloudtrace.v2.TraceService/CreateSpan",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TraceServiceServer).CreateSpan(ctx, req.(*Span))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _TraceService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "google.devtools.cloudtrace.v2.TraceService",
|
||||
HandlerType: (*TraceServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "BatchWriteSpans",
|
||||
Handler: _TraceService_BatchWriteSpans_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateSpan",
|
||||
Handler: _TraceService_CreateSpan_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "google/devtools/cloudtrace/v2/tracing.proto",
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google/devtools/cloudtrace/v2/tracing.proto", fileDescriptor_tracing_18786c49399bd83d)
|
||||
}
|
||||
|
||||
var fileDescriptor_tracing_18786c49399bd83d = []byte{
|
||||
// 404 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xdd, 0x6a, 0xdb, 0x30,
|
||||
0x14, 0x46, 0xde, 0x0f, 0x4c, 0x1b, 0x0c, 0x04, 0x0b, 0xc1, 0xdb, 0x58, 0xe6, 0x0d, 0x96, 0x64,
|
||||
0x43, 0x02, 0x8f, 0x5d, 0x2c, 0x63, 0x37, 0x09, 0x23, 0xb7, 0x21, 0x19, 0x19, 0x8c, 0xdc, 0x28,
|
||||
0x8e, 0xa6, 0x69, 0xd8, 0x92, 0x67, 0x29, 0x86, 0x52, 0x7a, 0xd3, 0x9b, 0x3e, 0x40, 0xfb, 0x14,
|
||||
0xa5, 0xd0, 0xf7, 0xe8, 0x6d, 0x5f, 0xa1, 0x0f, 0x52, 0x24, 0xd9, 0x0d, 0x84, 0x34, 0xc9, 0x9d,
|
||||
0xce, 0x39, 0xdf, 0xf9, 0xce, 0xf7, 0x7d, 0x36, 0xfc, 0xc8, 0x95, 0xe2, 0x29, 0x23, 0x0b, 0x56,
|
||||
0x1a, 0xa5, 0x52, 0x4d, 0x92, 0x54, 0x2d, 0x17, 0xa6, 0xa0, 0x09, 0x23, 0x65, 0x4c, 0xec, 0x43,
|
||||
0x48, 0x8e, 0xf3, 0x42, 0x19, 0x85, 0x5e, 0x7b, 0x30, 0xae, 0xc1, 0x78, 0x05, 0xc6, 0x65, 0x1c,
|
||||
0xbe, 0xaa, 0xb8, 0x68, 0x2e, 0x08, 0x95, 0x52, 0x19, 0x6a, 0x84, 0x92, 0xda, 0x2f, 0x87, 0x9d,
|
||||
0xdd, 0x97, 0x58, 0x05, 0x7d, 0x59, 0x41, 0x5d, 0x35, 0x5f, 0xfe, 0x21, 0x2c, 0xcb, 0xcd, 0x41,
|
||||
0x35, 0x7c, 0xb3, 0x3e, 0x34, 0x22, 0x63, 0xda, 0xd0, 0x2c, 0xf7, 0x80, 0x88, 0xc3, 0x46, 0x9f,
|
||||
0x9a, 0xe4, 0xef, 0xaf, 0x42, 0x18, 0x36, 0xc9, 0xa9, 0xd4, 0x63, 0xf6, 0x7f, 0xc9, 0xb4, 0x41,
|
||||
0x08, 0x3e, 0x94, 0x34, 0x63, 0x4d, 0xd0, 0x02, 0xed, 0x27, 0x63, 0xf7, 0x46, 0x5f, 0xe1, 0x23,
|
||||
0x6d, 0x31, 0xcd, 0xa0, 0xf5, 0xa0, 0xfd, 0x34, 0x7e, 0x87, 0xb7, 0x7a, 0xc4, 0x96, 0x6f, 0xec,
|
||||
0x37, 0xe2, 0xcb, 0x00, 0x3e, 0xfb, 0x69, 0x07, 0x13, 0x56, 0x94, 0x22, 0x61, 0xe8, 0x0c, 0xc0,
|
||||
0xe7, 0x6b, 0xa7, 0xd1, 0x97, 0x1d, 0x84, 0x9b, 0xa5, 0x86, 0x8d, 0x7a, 0xad, 0xb6, 0x89, 0x7f,
|
||||
0xd8, 0x0c, 0xa2, 0xf8, 0xf8, 0xfa, 0xe6, 0x34, 0xf8, 0x14, 0x7d, 0xb0, 0x99, 0x1d, 0x5a, 0x07,
|
||||
0xdf, 0xf3, 0x42, 0xfd, 0x63, 0x89, 0xd1, 0xa4, 0x7b, 0xe4, 0x53, 0xd4, 0xbd, 0xf9, 0x1d, 0x69,
|
||||
0x0f, 0x74, 0xd1, 0x09, 0x80, 0x70, 0x50, 0x30, 0xea, 0x4f, 0xa0, 0x7d, 0x2c, 0x86, 0xfb, 0x80,
|
||||
0x22, 0xe2, 0xc4, 0x74, 0xa2, 0xf7, 0x9b, 0xc4, 0x54, 0x5a, 0xac, 0x2a, 0x17, 0x57, 0x0f, 0x74,
|
||||
0xfb, 0x17, 0x00, 0xbe, 0x4d, 0x54, 0xb6, 0x9d, 0xbb, 0xef, 0x42, 0x15, 0x92, 0x8f, 0xac, 0xf5,
|
||||
0x11, 0xf8, 0x3d, 0xac, 0xe0, 0x5c, 0xa5, 0x54, 0x72, 0xac, 0x0a, 0x4e, 0x38, 0x93, 0x2e, 0x18,
|
||||
0xe2, 0x47, 0x34, 0x17, 0xfa, 0x9e, 0x1f, 0xeb, 0xdb, 0xaa, 0x3a, 0x0f, 0x5e, 0x0c, 0x3d, 0xd3,
|
||||
0xc0, 0xf6, 0xb0, 0xfb, 0x76, 0x78, 0x1a, 0x5f, 0xd5, 0xfd, 0x99, 0xeb, 0xcf, 0x5c, 0x7f, 0x36,
|
||||
0x8d, 0xe7, 0x8f, 0xdd, 0x8d, 0xcf, 0xb7, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbd, 0x94, 0x51, 0x1d,
|
||||
0x25, 0x03, 0x00, 0x00,
|
||||
}
|
||||
+958
@@ -0,0 +1,958 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/monitoring/v3/alert.proto
|
||||
|
||||
package monitoring // import "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import duration "github.com/golang/protobuf/ptypes/duration"
|
||||
import wrappers "github.com/golang/protobuf/ptypes/wrappers"
|
||||
import _ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
|
||||
// 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
|
||||
|
||||
// Operators for combining conditions.
|
||||
type AlertPolicy_ConditionCombinerType int32
|
||||
|
||||
const (
|
||||
// An unspecified combiner.
|
||||
AlertPolicy_COMBINE_UNSPECIFIED AlertPolicy_ConditionCombinerType = 0
|
||||
// Combine conditions using the logical `AND` operator. An
|
||||
// incident is created only if all conditions are met
|
||||
// simultaneously. This combiner is satisfied if all conditions are
|
||||
// met, even if they are met on completely different resources.
|
||||
AlertPolicy_AND AlertPolicy_ConditionCombinerType = 1
|
||||
// Combine conditions using the logical `OR` operator. An incident
|
||||
// is created if any of the listed conditions is met.
|
||||
AlertPolicy_OR AlertPolicy_ConditionCombinerType = 2
|
||||
// Combine conditions using logical `AND` operator, but unlike the regular
|
||||
// `AND` option, an incident is created only if all conditions are met
|
||||
// simultaneously on at least one resource.
|
||||
AlertPolicy_AND_WITH_MATCHING_RESOURCE AlertPolicy_ConditionCombinerType = 3
|
||||
)
|
||||
|
||||
var AlertPolicy_ConditionCombinerType_name = map[int32]string{
|
||||
0: "COMBINE_UNSPECIFIED",
|
||||
1: "AND",
|
||||
2: "OR",
|
||||
3: "AND_WITH_MATCHING_RESOURCE",
|
||||
}
|
||||
var AlertPolicy_ConditionCombinerType_value = map[string]int32{
|
||||
"COMBINE_UNSPECIFIED": 0,
|
||||
"AND": 1,
|
||||
"OR": 2,
|
||||
"AND_WITH_MATCHING_RESOURCE": 3,
|
||||
}
|
||||
|
||||
func (x AlertPolicy_ConditionCombinerType) String() string {
|
||||
return proto.EnumName(AlertPolicy_ConditionCombinerType_name, int32(x))
|
||||
}
|
||||
func (AlertPolicy_ConditionCombinerType) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_alert_3dd18d9aa69795e4, []int{0, 0}
|
||||
}
|
||||
|
||||
// A description of the conditions under which some aspect of your system is
|
||||
// considered to be "unhealthy" and the ways to notify people or services about
|
||||
// this state. For an overview of alert policies, see
|
||||
// [Introduction to Alerting](/monitoring/alerts/).
|
||||
type AlertPolicy struct {
|
||||
// Required if the policy exists. The resource name for this policy. The
|
||||
// syntax is:
|
||||
//
|
||||
// projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
|
||||
//
|
||||
// `[ALERT_POLICY_ID]` is assigned by Stackdriver Monitoring when the policy
|
||||
// is created. When calling the
|
||||
// [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
|
||||
// method, do not include the `name` field in the alerting policy passed as
|
||||
// part of the request.
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// A short name or phrase used to identify the policy in dashboards,
|
||||
// notifications, and incidents. To avoid confusion, don't use the same
|
||||
// display name for multiple policies in the same project. The name is
|
||||
// limited to 512 Unicode characters.
|
||||
DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
|
||||
// Documentation that is included with notifications and incidents related to
|
||||
// this policy. Best practice is for the documentation to include information
|
||||
// to help responders understand, mitigate, escalate, and correct the
|
||||
// underlying problems detected by the alerting policy. Notification channels
|
||||
// that have limited capacity might not show this documentation.
|
||||
Documentation *AlertPolicy_Documentation `protobuf:"bytes,13,opt,name=documentation,proto3" json:"documentation,omitempty"`
|
||||
// User-supplied key/value data to be used for organizing and
|
||||
// identifying the `AlertPolicy` objects.
|
||||
//
|
||||
// The field can contain up to 64 entries. Each key and value is limited to
|
||||
// 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
|
||||
// values can contain only lowercase letters, numerals, underscores, and
|
||||
// dashes. Keys must begin with a letter.
|
||||
UserLabels map[string]string `protobuf:"bytes,16,rep,name=user_labels,json=userLabels,proto3" json:"user_labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
// A list of conditions for the policy. The conditions are combined by AND or
|
||||
// OR according to the `combiner` field. If the combined conditions evaluate
|
||||
// to true, then an incident is created. A policy can have from one to six
|
||||
// conditions.
|
||||
Conditions []*AlertPolicy_Condition `protobuf:"bytes,12,rep,name=conditions,proto3" json:"conditions,omitempty"`
|
||||
// How to combine the results of multiple conditions
|
||||
// to determine if an incident should be opened.
|
||||
Combiner AlertPolicy_ConditionCombinerType `protobuf:"varint,6,opt,name=combiner,proto3,enum=google.monitoring.v3.AlertPolicy_ConditionCombinerType" json:"combiner,omitempty"`
|
||||
// Whether or not the policy is enabled. On write, the default interpretation
|
||||
// if unset is that the policy is enabled. On read, clients should not make
|
||||
// any assumption about the state if it has not been populated. The
|
||||
// field should always be populated on List and Get operations, unless
|
||||
// a field projection has been specified that strips it out.
|
||||
Enabled *wrappers.BoolValue `protobuf:"bytes,17,opt,name=enabled,proto3" json:"enabled,omitempty"`
|
||||
// Identifies the notification channels to which notifications should be sent
|
||||
// when incidents are opened or closed or when new violations occur on
|
||||
// an already opened incident. Each element of this array corresponds to
|
||||
// the `name` field in each of the
|
||||
// [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
|
||||
// objects that are returned from the [`ListNotificationChannels`]
|
||||
// [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
|
||||
// method. The syntax of the entries in this field is:
|
||||
//
|
||||
// projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
|
||||
NotificationChannels []string `protobuf:"bytes,14,rep,name=notification_channels,json=notificationChannels,proto3" json:"notification_channels,omitempty"`
|
||||
// A read-only record of the creation of the alerting policy. If provided
|
||||
// in a call to create or update, this field will be ignored.
|
||||
CreationRecord *MutationRecord `protobuf:"bytes,10,opt,name=creation_record,json=creationRecord,proto3" json:"creation_record,omitempty"`
|
||||
// A read-only record of the most recent change to the alerting policy. If
|
||||
// provided in a call to create or update, this field will be ignored.
|
||||
MutationRecord *MutationRecord `protobuf:"bytes,11,opt,name=mutation_record,json=mutationRecord,proto3" json:"mutation_record,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *AlertPolicy) Reset() { *m = AlertPolicy{} }
|
||||
func (m *AlertPolicy) String() string { return proto.CompactTextString(m) }
|
||||
func (*AlertPolicy) ProtoMessage() {}
|
||||
func (*AlertPolicy) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_alert_3dd18d9aa69795e4, []int{0}
|
||||
}
|
||||
func (m *AlertPolicy) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_AlertPolicy.Unmarshal(m, b)
|
||||
}
|
||||
func (m *AlertPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_AlertPolicy.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *AlertPolicy) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_AlertPolicy.Merge(dst, src)
|
||||
}
|
||||
func (m *AlertPolicy) XXX_Size() int {
|
||||
return xxx_messageInfo_AlertPolicy.Size(m)
|
||||
}
|
||||
func (m *AlertPolicy) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_AlertPolicy.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_AlertPolicy proto.InternalMessageInfo
|
||||
|
||||
func (m *AlertPolicy) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *AlertPolicy) GetDisplayName() string {
|
||||
if m != nil {
|
||||
return m.DisplayName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *AlertPolicy) GetDocumentation() *AlertPolicy_Documentation {
|
||||
if m != nil {
|
||||
return m.Documentation
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertPolicy) GetUserLabels() map[string]string {
|
||||
if m != nil {
|
||||
return m.UserLabels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertPolicy) GetConditions() []*AlertPolicy_Condition {
|
||||
if m != nil {
|
||||
return m.Conditions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertPolicy) GetCombiner() AlertPolicy_ConditionCombinerType {
|
||||
if m != nil {
|
||||
return m.Combiner
|
||||
}
|
||||
return AlertPolicy_COMBINE_UNSPECIFIED
|
||||
}
|
||||
|
||||
func (m *AlertPolicy) GetEnabled() *wrappers.BoolValue {
|
||||
if m != nil {
|
||||
return m.Enabled
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertPolicy) GetNotificationChannels() []string {
|
||||
if m != nil {
|
||||
return m.NotificationChannels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertPolicy) GetCreationRecord() *MutationRecord {
|
||||
if m != nil {
|
||||
return m.CreationRecord
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertPolicy) GetMutationRecord() *MutationRecord {
|
||||
if m != nil {
|
||||
return m.MutationRecord
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A content string and a MIME type that describes the content string's
|
||||
// format.
|
||||
type AlertPolicy_Documentation struct {
|
||||
// The text of the documentation, interpreted according to `mime_type`.
|
||||
// The content may not exceed 8,192 Unicode characters and may not exceed
|
||||
// more than 10,240 bytes when encoded in UTF-8 format, whichever is
|
||||
// smaller.
|
||||
Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
|
||||
// The format of the `content` field. Presently, only the value
|
||||
// `"text/markdown"` is supported. See
|
||||
// [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
|
||||
MimeType string `protobuf:"bytes,2,opt,name=mime_type,json=mimeType,proto3" json:"mime_type,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Documentation) Reset() { *m = AlertPolicy_Documentation{} }
|
||||
func (m *AlertPolicy_Documentation) String() string { return proto.CompactTextString(m) }
|
||||
func (*AlertPolicy_Documentation) ProtoMessage() {}
|
||||
func (*AlertPolicy_Documentation) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_alert_3dd18d9aa69795e4, []int{0, 0}
|
||||
}
|
||||
func (m *AlertPolicy_Documentation) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_AlertPolicy_Documentation.Unmarshal(m, b)
|
||||
}
|
||||
func (m *AlertPolicy_Documentation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_AlertPolicy_Documentation.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *AlertPolicy_Documentation) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_AlertPolicy_Documentation.Merge(dst, src)
|
||||
}
|
||||
func (m *AlertPolicy_Documentation) XXX_Size() int {
|
||||
return xxx_messageInfo_AlertPolicy_Documentation.Size(m)
|
||||
}
|
||||
func (m *AlertPolicy_Documentation) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_AlertPolicy_Documentation.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_AlertPolicy_Documentation proto.InternalMessageInfo
|
||||
|
||||
func (m *AlertPolicy_Documentation) GetContent() string {
|
||||
if m != nil {
|
||||
return m.Content
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Documentation) GetMimeType() string {
|
||||
if m != nil {
|
||||
return m.MimeType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// A condition is a true/false test that determines when an alerting policy
|
||||
// should open an incident. If a condition evaluates to true, it signifies
|
||||
// that something is wrong.
|
||||
type AlertPolicy_Condition struct {
|
||||
// Required if the condition exists. The unique resource name for this
|
||||
// condition. Its syntax is:
|
||||
//
|
||||
// projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
|
||||
//
|
||||
// `[CONDITION_ID]` is assigned by Stackdriver Monitoring when the
|
||||
// condition is created as part of a new or updated alerting policy.
|
||||
//
|
||||
// When calling the
|
||||
// [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
|
||||
// method, do not include the `name` field in the conditions of the
|
||||
// requested alerting policy. Stackdriver Monitoring creates the
|
||||
// condition identifiers and includes them in the new policy.
|
||||
//
|
||||
// When calling the
|
||||
// [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy]
|
||||
// method to update a policy, including a condition `name` causes the
|
||||
// existing condition to be updated. Conditions without names are added to
|
||||
// the updated policy. Existing conditions are deleted if they are not
|
||||
// updated.
|
||||
//
|
||||
// Best practice is to preserve `[CONDITION_ID]` if you make only small
|
||||
// changes, such as those to condition thresholds, durations, or trigger
|
||||
// values. Otherwise, treat the change as a new condition and let the
|
||||
// existing condition be deleted.
|
||||
Name string `protobuf:"bytes,12,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// A short name or phrase used to identify the condition in dashboards,
|
||||
// notifications, and incidents. To avoid confusion, don't use the same
|
||||
// display name for multiple conditions in the same policy.
|
||||
DisplayName string `protobuf:"bytes,6,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
|
||||
// Only one of the following condition types will be specified.
|
||||
//
|
||||
// Types that are valid to be assigned to Condition:
|
||||
// *AlertPolicy_Condition_ConditionThreshold
|
||||
// *AlertPolicy_Condition_ConditionAbsent
|
||||
Condition isAlertPolicy_Condition_Condition `protobuf_oneof:"condition"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition) Reset() { *m = AlertPolicy_Condition{} }
|
||||
func (m *AlertPolicy_Condition) String() string { return proto.CompactTextString(m) }
|
||||
func (*AlertPolicy_Condition) ProtoMessage() {}
|
||||
func (*AlertPolicy_Condition) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_alert_3dd18d9aa69795e4, []int{0, 1}
|
||||
}
|
||||
func (m *AlertPolicy_Condition) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_AlertPolicy_Condition.Unmarshal(m, b)
|
||||
}
|
||||
func (m *AlertPolicy_Condition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_AlertPolicy_Condition.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *AlertPolicy_Condition) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_AlertPolicy_Condition.Merge(dst, src)
|
||||
}
|
||||
func (m *AlertPolicy_Condition) XXX_Size() int {
|
||||
return xxx_messageInfo_AlertPolicy_Condition.Size(m)
|
||||
}
|
||||
func (m *AlertPolicy_Condition) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_AlertPolicy_Condition.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_AlertPolicy_Condition proto.InternalMessageInfo
|
||||
|
||||
func (m *AlertPolicy_Condition) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition) GetDisplayName() string {
|
||||
if m != nil {
|
||||
return m.DisplayName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type isAlertPolicy_Condition_Condition interface {
|
||||
isAlertPolicy_Condition_Condition()
|
||||
}
|
||||
|
||||
type AlertPolicy_Condition_ConditionThreshold struct {
|
||||
ConditionThreshold *AlertPolicy_Condition_MetricThreshold `protobuf:"bytes,1,opt,name=condition_threshold,json=conditionThreshold,proto3,oneof"`
|
||||
}
|
||||
|
||||
type AlertPolicy_Condition_ConditionAbsent struct {
|
||||
ConditionAbsent *AlertPolicy_Condition_MetricAbsence `protobuf:"bytes,2,opt,name=condition_absent,json=conditionAbsent,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*AlertPolicy_Condition_ConditionThreshold) isAlertPolicy_Condition_Condition() {}
|
||||
|
||||
func (*AlertPolicy_Condition_ConditionAbsent) isAlertPolicy_Condition_Condition() {}
|
||||
|
||||
func (m *AlertPolicy_Condition) GetCondition() isAlertPolicy_Condition_Condition {
|
||||
if m != nil {
|
||||
return m.Condition
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition) GetConditionThreshold() *AlertPolicy_Condition_MetricThreshold {
|
||||
if x, ok := m.GetCondition().(*AlertPolicy_Condition_ConditionThreshold); ok {
|
||||
return x.ConditionThreshold
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition) GetConditionAbsent() *AlertPolicy_Condition_MetricAbsence {
|
||||
if x, ok := m.GetCondition().(*AlertPolicy_Condition_ConditionAbsent); ok {
|
||||
return x.ConditionAbsent
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*AlertPolicy_Condition) 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 _AlertPolicy_Condition_OneofMarshaler, _AlertPolicy_Condition_OneofUnmarshaler, _AlertPolicy_Condition_OneofSizer, []interface{}{
|
||||
(*AlertPolicy_Condition_ConditionThreshold)(nil),
|
||||
(*AlertPolicy_Condition_ConditionAbsent)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _AlertPolicy_Condition_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*AlertPolicy_Condition)
|
||||
// condition
|
||||
switch x := m.Condition.(type) {
|
||||
case *AlertPolicy_Condition_ConditionThreshold:
|
||||
b.EncodeVarint(1<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.ConditionThreshold); err != nil {
|
||||
return err
|
||||
}
|
||||
case *AlertPolicy_Condition_ConditionAbsent:
|
||||
b.EncodeVarint(2<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.ConditionAbsent); err != nil {
|
||||
return err
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("AlertPolicy_Condition.Condition has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _AlertPolicy_Condition_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*AlertPolicy_Condition)
|
||||
switch tag {
|
||||
case 1: // condition.condition_threshold
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(AlertPolicy_Condition_MetricThreshold)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Condition = &AlertPolicy_Condition_ConditionThreshold{msg}
|
||||
return true, err
|
||||
case 2: // condition.condition_absent
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(AlertPolicy_Condition_MetricAbsence)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Condition = &AlertPolicy_Condition_ConditionAbsent{msg}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _AlertPolicy_Condition_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*AlertPolicy_Condition)
|
||||
// condition
|
||||
switch x := m.Condition.(type) {
|
||||
case *AlertPolicy_Condition_ConditionThreshold:
|
||||
s := proto.Size(x.ConditionThreshold)
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *AlertPolicy_Condition_ConditionAbsent:
|
||||
s := proto.Size(x.ConditionAbsent)
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// Specifies how many time series must fail a predicate to trigger a
|
||||
// condition. If not specified, then a `{count: 1}` trigger is used.
|
||||
type AlertPolicy_Condition_Trigger struct {
|
||||
// A type of trigger.
|
||||
//
|
||||
// Types that are valid to be assigned to Type:
|
||||
// *AlertPolicy_Condition_Trigger_Count
|
||||
// *AlertPolicy_Condition_Trigger_Percent
|
||||
Type isAlertPolicy_Condition_Trigger_Type `protobuf_oneof:"type"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition_Trigger) Reset() { *m = AlertPolicy_Condition_Trigger{} }
|
||||
func (m *AlertPolicy_Condition_Trigger) String() string { return proto.CompactTextString(m) }
|
||||
func (*AlertPolicy_Condition_Trigger) ProtoMessage() {}
|
||||
func (*AlertPolicy_Condition_Trigger) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_alert_3dd18d9aa69795e4, []int{0, 1, 0}
|
||||
}
|
||||
func (m *AlertPolicy_Condition_Trigger) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_AlertPolicy_Condition_Trigger.Unmarshal(m, b)
|
||||
}
|
||||
func (m *AlertPolicy_Condition_Trigger) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_AlertPolicy_Condition_Trigger.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *AlertPolicy_Condition_Trigger) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_AlertPolicy_Condition_Trigger.Merge(dst, src)
|
||||
}
|
||||
func (m *AlertPolicy_Condition_Trigger) XXX_Size() int {
|
||||
return xxx_messageInfo_AlertPolicy_Condition_Trigger.Size(m)
|
||||
}
|
||||
func (m *AlertPolicy_Condition_Trigger) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_AlertPolicy_Condition_Trigger.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_AlertPolicy_Condition_Trigger proto.InternalMessageInfo
|
||||
|
||||
type isAlertPolicy_Condition_Trigger_Type interface {
|
||||
isAlertPolicy_Condition_Trigger_Type()
|
||||
}
|
||||
|
||||
type AlertPolicy_Condition_Trigger_Count struct {
|
||||
Count int32 `protobuf:"varint,1,opt,name=count,proto3,oneof"`
|
||||
}
|
||||
|
||||
type AlertPolicy_Condition_Trigger_Percent struct {
|
||||
Percent float64 `protobuf:"fixed64,2,opt,name=percent,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*AlertPolicy_Condition_Trigger_Count) isAlertPolicy_Condition_Trigger_Type() {}
|
||||
|
||||
func (*AlertPolicy_Condition_Trigger_Percent) isAlertPolicy_Condition_Trigger_Type() {}
|
||||
|
||||
func (m *AlertPolicy_Condition_Trigger) GetType() isAlertPolicy_Condition_Trigger_Type {
|
||||
if m != nil {
|
||||
return m.Type
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition_Trigger) GetCount() int32 {
|
||||
if x, ok := m.GetType().(*AlertPolicy_Condition_Trigger_Count); ok {
|
||||
return x.Count
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition_Trigger) GetPercent() float64 {
|
||||
if x, ok := m.GetType().(*AlertPolicy_Condition_Trigger_Percent); ok {
|
||||
return x.Percent
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*AlertPolicy_Condition_Trigger) 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 _AlertPolicy_Condition_Trigger_OneofMarshaler, _AlertPolicy_Condition_Trigger_OneofUnmarshaler, _AlertPolicy_Condition_Trigger_OneofSizer, []interface{}{
|
||||
(*AlertPolicy_Condition_Trigger_Count)(nil),
|
||||
(*AlertPolicy_Condition_Trigger_Percent)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _AlertPolicy_Condition_Trigger_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*AlertPolicy_Condition_Trigger)
|
||||
// type
|
||||
switch x := m.Type.(type) {
|
||||
case *AlertPolicy_Condition_Trigger_Count:
|
||||
b.EncodeVarint(1<<3 | proto.WireVarint)
|
||||
b.EncodeVarint(uint64(x.Count))
|
||||
case *AlertPolicy_Condition_Trigger_Percent:
|
||||
b.EncodeVarint(2<<3 | proto.WireFixed64)
|
||||
b.EncodeFixed64(math.Float64bits(x.Percent))
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("AlertPolicy_Condition_Trigger.Type has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _AlertPolicy_Condition_Trigger_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*AlertPolicy_Condition_Trigger)
|
||||
switch tag {
|
||||
case 1: // type.count
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeVarint()
|
||||
m.Type = &AlertPolicy_Condition_Trigger_Count{int32(x)}
|
||||
return true, err
|
||||
case 2: // type.percent
|
||||
if wire != proto.WireFixed64 {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeFixed64()
|
||||
m.Type = &AlertPolicy_Condition_Trigger_Percent{math.Float64frombits(x)}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _AlertPolicy_Condition_Trigger_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*AlertPolicy_Condition_Trigger)
|
||||
// type
|
||||
switch x := m.Type.(type) {
|
||||
case *AlertPolicy_Condition_Trigger_Count:
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(x.Count))
|
||||
case *AlertPolicy_Condition_Trigger_Percent:
|
||||
n += 1 // tag and wire
|
||||
n += 8
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// A condition type that compares a collection of time series
|
||||
// against a threshold.
|
||||
type AlertPolicy_Condition_MetricThreshold struct {
|
||||
// A [filter](/monitoring/api/v3/filters) that
|
||||
// identifies which time series should be compared with the threshold.
|
||||
//
|
||||
// The filter is similar to the one that is specified in the
|
||||
// [`MetricService.ListTimeSeries`
|
||||
// request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
|
||||
// call is useful to verify the time series that will be retrieved /
|
||||
// processed) and must specify the metric type and optionally may contain
|
||||
// restrictions on resource type, resource labels, and metric labels.
|
||||
// This field may not exceed 2048 Unicode characters in length.
|
||||
Filter string `protobuf:"bytes,2,opt,name=filter,proto3" json:"filter,omitempty"`
|
||||
// Specifies the alignment of data points in individual time series as
|
||||
// well as how to combine the retrieved time series together (such as
|
||||
// when aggregating multiple streams on each resource to a single
|
||||
// stream for each resource or when aggregating streams across all
|
||||
// members of a group of resrouces). Multiple aggregations
|
||||
// are applied in the order specified.
|
||||
//
|
||||
// This field is similar to the one in the
|
||||
// [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
|
||||
// It is advisable to use the `ListTimeSeries` method when debugging this field.
|
||||
Aggregations []*Aggregation `protobuf:"bytes,8,rep,name=aggregations,proto3" json:"aggregations,omitempty"`
|
||||
// A [filter](/monitoring/api/v3/filters) that identifies a time
|
||||
// series that should be used as the denominator of a ratio that will be
|
||||
// compared with the threshold. If a `denominator_filter` is specified,
|
||||
// the time series specified by the `filter` field will be used as the
|
||||
// numerator.
|
||||
//
|
||||
// The filter is similar to the one that is specified in the
|
||||
// [`MetricService.ListTimeSeries`
|
||||
// request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
|
||||
// call is useful to verify the time series that will be retrieved /
|
||||
// processed) and must specify the metric type and optionally may contain
|
||||
// restrictions on resource type, resource labels, and metric labels.
|
||||
// This field may not exceed 2048 Unicode characters in length.
|
||||
DenominatorFilter string `protobuf:"bytes,9,opt,name=denominator_filter,json=denominatorFilter,proto3" json:"denominator_filter,omitempty"`
|
||||
// Specifies the alignment of data points in individual time series
|
||||
// selected by `denominatorFilter` as
|
||||
// well as how to combine the retrieved time series together (such as
|
||||
// when aggregating multiple streams on each resource to a single
|
||||
// stream for each resource or when aggregating streams across all
|
||||
// members of a group of resources).
|
||||
//
|
||||
// When computing ratios, the `aggregations` and
|
||||
// `denominator_aggregations` fields must use the same alignment period
|
||||
// and produce time series that have the same periodicity and labels.
|
||||
//
|
||||
// This field is similar to the one in the
|
||||
// [`MetricService.ListTimeSeries`
|
||||
// request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
|
||||
// is advisable to use the `ListTimeSeries` method when debugging this
|
||||
// field.
|
||||
DenominatorAggregations []*Aggregation `protobuf:"bytes,10,rep,name=denominator_aggregations,json=denominatorAggregations,proto3" json:"denominator_aggregations,omitempty"`
|
||||
// The comparison to apply between the time series (indicated by `filter`
|
||||
// and `aggregation`) and the threshold (indicated by `threshold_value`).
|
||||
// The comparison is applied on each time series, with the time series
|
||||
// on the left-hand side and the threshold on the right-hand side.
|
||||
//
|
||||
// Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
|
||||
Comparison ComparisonType `protobuf:"varint,4,opt,name=comparison,proto3,enum=google.monitoring.v3.ComparisonType" json:"comparison,omitempty"`
|
||||
// A value against which to compare the time series.
|
||||
ThresholdValue float64 `protobuf:"fixed64,5,opt,name=threshold_value,json=thresholdValue,proto3" json:"threshold_value,omitempty"`
|
||||
// The amount of time that a time series must violate the
|
||||
// threshold to be considered failing. Currently, only values
|
||||
// that are a multiple of a minute--e.g., 0, 60, 120, or 300
|
||||
// seconds--are supported. If an invalid value is given, an
|
||||
// error will be returned. When choosing a duration, it is useful to
|
||||
// keep in mind the frequency of the underlying time series data
|
||||
// (which may also be affected by any alignments specified in the
|
||||
// `aggregations` field); a good duration is long enough so that a single
|
||||
// outlier does not generate spurious alerts, but short enough that
|
||||
// unhealthy states are detected and alerted on quickly.
|
||||
Duration *duration.Duration `protobuf:"bytes,6,opt,name=duration,proto3" json:"duration,omitempty"`
|
||||
// The number/percent of time series for which the comparison must hold
|
||||
// in order for the condition to trigger. If unspecified, then the
|
||||
// condition will trigger if the comparison is true for any of the
|
||||
// time series that have been identified by `filter` and `aggregations`,
|
||||
// or by the ratio, if `denominator_filter` and `denominator_aggregations`
|
||||
// are specified.
|
||||
Trigger *AlertPolicy_Condition_Trigger `protobuf:"bytes,7,opt,name=trigger,proto3" json:"trigger,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition_MetricThreshold) Reset() { *m = AlertPolicy_Condition_MetricThreshold{} }
|
||||
func (m *AlertPolicy_Condition_MetricThreshold) String() string { return proto.CompactTextString(m) }
|
||||
func (*AlertPolicy_Condition_MetricThreshold) ProtoMessage() {}
|
||||
func (*AlertPolicy_Condition_MetricThreshold) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_alert_3dd18d9aa69795e4, []int{0, 1, 1}
|
||||
}
|
||||
func (m *AlertPolicy_Condition_MetricThreshold) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_AlertPolicy_Condition_MetricThreshold.Unmarshal(m, b)
|
||||
}
|
||||
func (m *AlertPolicy_Condition_MetricThreshold) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_AlertPolicy_Condition_MetricThreshold.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *AlertPolicy_Condition_MetricThreshold) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_AlertPolicy_Condition_MetricThreshold.Merge(dst, src)
|
||||
}
|
||||
func (m *AlertPolicy_Condition_MetricThreshold) XXX_Size() int {
|
||||
return xxx_messageInfo_AlertPolicy_Condition_MetricThreshold.Size(m)
|
||||
}
|
||||
func (m *AlertPolicy_Condition_MetricThreshold) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_AlertPolicy_Condition_MetricThreshold.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_AlertPolicy_Condition_MetricThreshold proto.InternalMessageInfo
|
||||
|
||||
func (m *AlertPolicy_Condition_MetricThreshold) GetFilter() string {
|
||||
if m != nil {
|
||||
return m.Filter
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition_MetricThreshold) GetAggregations() []*Aggregation {
|
||||
if m != nil {
|
||||
return m.Aggregations
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition_MetricThreshold) GetDenominatorFilter() string {
|
||||
if m != nil {
|
||||
return m.DenominatorFilter
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition_MetricThreshold) GetDenominatorAggregations() []*Aggregation {
|
||||
if m != nil {
|
||||
return m.DenominatorAggregations
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition_MetricThreshold) GetComparison() ComparisonType {
|
||||
if m != nil {
|
||||
return m.Comparison
|
||||
}
|
||||
return ComparisonType_COMPARISON_UNSPECIFIED
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition_MetricThreshold) GetThresholdValue() float64 {
|
||||
if m != nil {
|
||||
return m.ThresholdValue
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition_MetricThreshold) GetDuration() *duration.Duration {
|
||||
if m != nil {
|
||||
return m.Duration
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition_MetricThreshold) GetTrigger() *AlertPolicy_Condition_Trigger {
|
||||
if m != nil {
|
||||
return m.Trigger
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A condition type that checks that monitored resources
|
||||
// are reporting data. The configuration defines a metric and
|
||||
// a set of monitored resources. The predicate is considered in violation
|
||||
// when a time series for the specified metric of a monitored
|
||||
// resource does not include any data in the specified `duration`.
|
||||
type AlertPolicy_Condition_MetricAbsence struct {
|
||||
// A [filter](/monitoring/api/v3/filters) that
|
||||
// identifies which time series should be compared with the threshold.
|
||||
//
|
||||
// The filter is similar to the one that is specified in the
|
||||
// [`MetricService.ListTimeSeries`
|
||||
// request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
|
||||
// call is useful to verify the time series that will be retrieved /
|
||||
// processed) and must specify the metric type and optionally may contain
|
||||
// restrictions on resource type, resource labels, and metric labels.
|
||||
// This field may not exceed 2048 Unicode characters in length.
|
||||
Filter string `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"`
|
||||
// Specifies the alignment of data points in individual time series as
|
||||
// well as how to combine the retrieved time series together (such as
|
||||
// when aggregating multiple streams on each resource to a single
|
||||
// stream for each resource or when aggregating streams across all
|
||||
// members of a group of resrouces). Multiple aggregations
|
||||
// are applied in the order specified.
|
||||
//
|
||||
// This field is similar to the
|
||||
// one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
|
||||
// It is advisable to use the `ListTimeSeries` method when debugging this field.
|
||||
Aggregations []*Aggregation `protobuf:"bytes,5,rep,name=aggregations,proto3" json:"aggregations,omitempty"`
|
||||
// The amount of time that a time series must fail to report new
|
||||
// data to be considered failing. Currently, only values that
|
||||
// are a multiple of a minute--e.g. 60, 120, or 300
|
||||
// seconds--are supported. If an invalid value is given, an
|
||||
// error will be returned. The `Duration.nanos` field is
|
||||
// ignored.
|
||||
Duration *duration.Duration `protobuf:"bytes,2,opt,name=duration,proto3" json:"duration,omitempty"`
|
||||
// The number/percent of time series for which the comparison must hold
|
||||
// in order for the condition to trigger. If unspecified, then the
|
||||
// condition will trigger if the comparison is true for any of the
|
||||
// time series that have been identified by `filter` and `aggregations`.
|
||||
Trigger *AlertPolicy_Condition_Trigger `protobuf:"bytes,3,opt,name=trigger,proto3" json:"trigger,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition_MetricAbsence) Reset() { *m = AlertPolicy_Condition_MetricAbsence{} }
|
||||
func (m *AlertPolicy_Condition_MetricAbsence) String() string { return proto.CompactTextString(m) }
|
||||
func (*AlertPolicy_Condition_MetricAbsence) ProtoMessage() {}
|
||||
func (*AlertPolicy_Condition_MetricAbsence) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_alert_3dd18d9aa69795e4, []int{0, 1, 2}
|
||||
}
|
||||
func (m *AlertPolicy_Condition_MetricAbsence) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_AlertPolicy_Condition_MetricAbsence.Unmarshal(m, b)
|
||||
}
|
||||
func (m *AlertPolicy_Condition_MetricAbsence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_AlertPolicy_Condition_MetricAbsence.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *AlertPolicy_Condition_MetricAbsence) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_AlertPolicy_Condition_MetricAbsence.Merge(dst, src)
|
||||
}
|
||||
func (m *AlertPolicy_Condition_MetricAbsence) XXX_Size() int {
|
||||
return xxx_messageInfo_AlertPolicy_Condition_MetricAbsence.Size(m)
|
||||
}
|
||||
func (m *AlertPolicy_Condition_MetricAbsence) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_AlertPolicy_Condition_MetricAbsence.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_AlertPolicy_Condition_MetricAbsence proto.InternalMessageInfo
|
||||
|
||||
func (m *AlertPolicy_Condition_MetricAbsence) GetFilter() string {
|
||||
if m != nil {
|
||||
return m.Filter
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition_MetricAbsence) GetAggregations() []*Aggregation {
|
||||
if m != nil {
|
||||
return m.Aggregations
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition_MetricAbsence) GetDuration() *duration.Duration {
|
||||
if m != nil {
|
||||
return m.Duration
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlertPolicy_Condition_MetricAbsence) GetTrigger() *AlertPolicy_Condition_Trigger {
|
||||
if m != nil {
|
||||
return m.Trigger
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*AlertPolicy)(nil), "google.monitoring.v3.AlertPolicy")
|
||||
proto.RegisterMapType((map[string]string)(nil), "google.monitoring.v3.AlertPolicy.UserLabelsEntry")
|
||||
proto.RegisterType((*AlertPolicy_Documentation)(nil), "google.monitoring.v3.AlertPolicy.Documentation")
|
||||
proto.RegisterType((*AlertPolicy_Condition)(nil), "google.monitoring.v3.AlertPolicy.Condition")
|
||||
proto.RegisterType((*AlertPolicy_Condition_Trigger)(nil), "google.monitoring.v3.AlertPolicy.Condition.Trigger")
|
||||
proto.RegisterType((*AlertPolicy_Condition_MetricThreshold)(nil), "google.monitoring.v3.AlertPolicy.Condition.MetricThreshold")
|
||||
proto.RegisterType((*AlertPolicy_Condition_MetricAbsence)(nil), "google.monitoring.v3.AlertPolicy.Condition.MetricAbsence")
|
||||
proto.RegisterEnum("google.monitoring.v3.AlertPolicy_ConditionCombinerType", AlertPolicy_ConditionCombinerType_name, AlertPolicy_ConditionCombinerType_value)
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google/monitoring/v3/alert.proto", fileDescriptor_alert_3dd18d9aa69795e4)
|
||||
}
|
||||
|
||||
var fileDescriptor_alert_3dd18d9aa69795e4 = []byte{
|
||||
// 941 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xeb, 0x6e, 0xe3, 0x44,
|
||||
0x14, 0xae, 0x93, 0xe6, 0x76, 0xd2, 0x36, 0xd9, 0xd9, 0xee, 0xae, 0x31, 0x68, 0x95, 0xae, 0x90,
|
||||
0x88, 0x40, 0x38, 0x22, 0x01, 0x71, 0x59, 0x81, 0x94, 0x5b, 0x37, 0x11, 0x24, 0xad, 0xa6, 0x69,
|
||||
0x91, 0x50, 0x25, 0xcb, 0x71, 0xa6, 0xae, 0x85, 0x3d, 0x63, 0x4d, 0xec, 0xa2, 0xbc, 0x0e, 0x3f,
|
||||
0x79, 0x14, 0x1e, 0x81, 0x7f, 0xbc, 0x02, 0xe2, 0x01, 0x90, 0xc7, 0x63, 0xc7, 0xe9, 0xa6, 0xbb,
|
||||
0x64, 0xf7, 0x5f, 0xce, 0x9c, 0xef, 0x7c, 0xe7, 0xf6, 0xcd, 0x38, 0xd0, 0xb0, 0x19, 0xb3, 0x5d,
|
||||
0xd2, 0xf2, 0x18, 0x75, 0x02, 0xc6, 0x1d, 0x6a, 0xb7, 0xee, 0x3a, 0x2d, 0xd3, 0x25, 0x3c, 0xd0,
|
||||
0x7d, 0xce, 0x02, 0x86, 0x8e, 0x63, 0x84, 0xbe, 0x46, 0xe8, 0x77, 0x1d, 0xed, 0x23, 0x19, 0x67,
|
||||
0xfa, 0x4e, 0xcb, 0xa4, 0x94, 0x05, 0x66, 0xe0, 0x30, 0xba, 0x8c, 0x63, 0xb4, 0x93, 0xad, 0xac,
|
||||
0x16, 0xf3, 0x3c, 0x46, 0x25, 0xe4, 0xd3, 0xad, 0x10, 0x2f, 0x8c, 0x89, 0x0c, 0x4e, 0x2c, 0xc6,
|
||||
0x17, 0x12, 0xfb, 0x5c, 0x62, 0x85, 0x35, 0x0f, 0x6f, 0x5a, 0x8b, 0x90, 0x0b, 0xd8, 0x43, 0xfe,
|
||||
0xdf, 0xb8, 0xe9, 0xfb, 0x84, 0xcb, 0x72, 0x5e, 0xfc, 0x5d, 0x83, 0x6a, 0x37, 0x6a, 0xe9, 0x9c,
|
||||
0xb9, 0x8e, 0xb5, 0x42, 0x08, 0xf6, 0xa9, 0xe9, 0x11, 0x55, 0x69, 0x28, 0xcd, 0x0a, 0x16, 0xbf,
|
||||
0xd1, 0x09, 0x1c, 0x2c, 0x9c, 0xa5, 0xef, 0x9a, 0x2b, 0x43, 0xf8, 0x72, 0xc2, 0x57, 0x95, 0x67,
|
||||
0xd3, 0x08, 0x72, 0x09, 0x87, 0x0b, 0x66, 0x85, 0x1e, 0xa1, 0x71, 0x91, 0xea, 0x61, 0x43, 0x69,
|
||||
0x56, 0xdb, 0x2d, 0x7d, 0xdb, 0x84, 0xf4, 0x4c, 0x42, 0x7d, 0x90, 0x0d, 0xc3, 0x9b, 0x2c, 0x08,
|
||||
0x43, 0x35, 0x5c, 0x12, 0x6e, 0xb8, 0xe6, 0x9c, 0xb8, 0x4b, 0xb5, 0xde, 0xc8, 0x37, 0xab, 0xed,
|
||||
0x2f, 0xde, 0x4e, 0x7a, 0xb9, 0x24, 0xfc, 0x27, 0x11, 0x33, 0xa4, 0x01, 0x5f, 0x61, 0x08, 0xd3,
|
||||
0x03, 0xf4, 0x23, 0x80, 0xc5, 0xe8, 0xc2, 0x11, 0x4b, 0x51, 0x0f, 0x04, 0xe5, 0x67, 0x6f, 0xa7,
|
||||
0xec, 0x27, 0x31, 0x38, 0x13, 0x8e, 0x2e, 0xa0, 0x6c, 0x31, 0x6f, 0xee, 0x50, 0xc2, 0xd5, 0x62,
|
||||
0x43, 0x69, 0x1e, 0xb5, 0xbf, 0xde, 0x81, 0xaa, 0x2f, 0x43, 0x67, 0x2b, 0x9f, 0xe0, 0x94, 0x08,
|
||||
0x7d, 0x09, 0x25, 0x42, 0xcd, 0xb9, 0x4b, 0x16, 0xea, 0x23, 0x31, 0x46, 0x2d, 0xe1, 0x4c, 0xb6,
|
||||
0xa8, 0xf7, 0x18, 0x73, 0xaf, 0x4c, 0x37, 0x24, 0x38, 0x81, 0xa2, 0x0e, 0x3c, 0xa1, 0x2c, 0x70,
|
||||
0x6e, 0x1c, 0x2b, 0x96, 0x89, 0x75, 0x6b, 0x52, 0x1a, 0x4d, 0xed, 0xa8, 0x91, 0x6f, 0x56, 0xf0,
|
||||
0x71, 0xd6, 0xd9, 0x97, 0x3e, 0x34, 0x81, 0x9a, 0xc5, 0x49, 0x56, 0x57, 0x2a, 0x88, 0x94, 0x1f,
|
||||
0x6f, 0x6f, 0x63, 0x22, 0x45, 0x88, 0x05, 0x16, 0x1f, 0x25, 0xc1, 0xb1, 0x1d, 0xd1, 0xdd, 0x93,
|
||||
0xa9, 0x5a, 0xdd, 0x85, 0xce, 0xdb, 0xb0, 0xb5, 0x53, 0x38, 0xdc, 0x90, 0x07, 0x52, 0xa1, 0x64,
|
||||
0x31, 0x1a, 0x10, 0x1a, 0x48, 0x81, 0x26, 0x26, 0xfa, 0x10, 0x2a, 0x9e, 0xe3, 0x11, 0x23, 0x58,
|
||||
0xf9, 0x89, 0x40, 0xcb, 0xd1, 0x41, 0x34, 0x5a, 0xed, 0xaf, 0x32, 0x54, 0xd2, 0xa1, 0xa7, 0x12,
|
||||
0x3f, 0x78, 0x83, 0xc4, 0x8b, 0xaf, 0x4b, 0x9c, 0xc2, 0xe3, 0x74, 0xf1, 0x46, 0x70, 0xcb, 0xc9,
|
||||
0xf2, 0x96, 0xb9, 0x0b, 0x51, 0x47, 0xb5, 0xfd, 0x72, 0x87, 0xad, 0xeb, 0x13, 0x12, 0x70, 0xc7,
|
||||
0x9a, 0x25, 0x14, 0xa3, 0x3d, 0x8c, 0x52, 0xe6, 0xf4, 0x14, 0xdd, 0x40, 0x7d, 0x9d, 0xcf, 0x9c,
|
||||
0x2f, 0xa3, 0xa6, 0x73, 0x22, 0xd9, 0xb7, 0xbb, 0x27, 0xeb, 0x46, 0xf1, 0x16, 0x19, 0xed, 0xe1,
|
||||
0x5a, 0x4a, 0x2a, 0xce, 0x02, 0x6d, 0x08, 0xa5, 0x19, 0x77, 0x6c, 0x9b, 0x70, 0xf4, 0x14, 0x0a,
|
||||
0x16, 0x0b, 0xe5, 0x70, 0x0b, 0xa3, 0x3d, 0x1c, 0x9b, 0x48, 0x83, 0x92, 0x4f, 0xb8, 0x95, 0x54,
|
||||
0xa0, 0x8c, 0xf6, 0x70, 0x72, 0xd0, 0x2b, 0xc2, 0x7e, 0x34, 0x73, 0xed, 0x9f, 0x3c, 0xd4, 0xee,
|
||||
0x35, 0x86, 0x9e, 0x42, 0xf1, 0xc6, 0x71, 0x03, 0xc2, 0xe5, 0x46, 0xa4, 0x85, 0x86, 0x70, 0x60,
|
||||
0xda, 0x36, 0x27, 0x76, 0xfc, 0x32, 0xaa, 0x65, 0x71, 0x09, 0x4f, 0x1e, 0x68, 0x6b, 0x8d, 0xc4,
|
||||
0x1b, 0x61, 0xe8, 0x73, 0x40, 0x0b, 0x42, 0x99, 0xe7, 0x50, 0x33, 0x60, 0xdc, 0x90, 0xa9, 0x2a,
|
||||
0x22, 0xd5, 0xa3, 0x8c, 0xe7, 0x34, 0xce, 0x7a, 0x0d, 0x6a, 0x16, 0xbe, 0x51, 0x01, 0xfc, 0xdf,
|
||||
0x0a, 0x9e, 0x65, 0x28, 0xba, 0xd9, 0x62, 0x06, 0xd1, 0xb3, 0xe2, 0xf9, 0x26, 0x77, 0x96, 0x8c,
|
||||
0xaa, 0xfb, 0xe2, 0x2d, 0x78, 0x40, 0xf5, 0xfd, 0x14, 0x27, 0x2e, 0x7e, 0x26, 0x0e, 0x7d, 0x02,
|
||||
0xb5, 0x54, 0x5a, 0xc6, 0x5d, 0x74, 0xc1, 0xd5, 0x42, 0x34, 0x71, 0x7c, 0x94, 0x1e, 0x8b, 0x6b,
|
||||
0x8f, 0xbe, 0x82, 0x72, 0xf2, 0xd2, 0x0b, 0xb1, 0x56, 0xdb, 0x1f, 0xbc, 0xf6, 0x48, 0x0c, 0x24,
|
||||
0x00, 0xa7, 0x50, 0x34, 0x81, 0x52, 0x10, 0x2f, 0x5b, 0x2d, 0x89, 0xa8, 0xce, 0x2e, 0x5a, 0x92,
|
||||
0x3a, 0xc1, 0x09, 0x87, 0xf6, 0xaf, 0x02, 0x87, 0x1b, 0x02, 0xcb, 0xac, 0x5c, 0x79, 0xe3, 0xca,
|
||||
0x0b, 0xef, 0xb6, 0xf2, 0x6c, 0xdb, 0xb9, 0x77, 0x6a, 0x3b, 0xff, 0xfe, 0x6d, 0xf7, 0xaa, 0x50,
|
||||
0x49, 0x6f, 0x91, 0xf6, 0x3d, 0xd4, 0xee, 0x7d, 0x6e, 0x50, 0x1d, 0xf2, 0xbf, 0x92, 0x95, 0x9c,
|
||||
0x40, 0xf4, 0x13, 0x1d, 0x43, 0x21, 0xde, 0x66, 0x7c, 0x11, 0x62, 0xe3, 0xbb, 0xdc, 0x37, 0xca,
|
||||
0x0b, 0x13, 0x9e, 0x6c, 0xfd, 0x1e, 0xa0, 0x67, 0xf0, 0xb8, 0x7f, 0x36, 0xe9, 0x8d, 0xa7, 0x43,
|
||||
0xe3, 0x72, 0x7a, 0x71, 0x3e, 0xec, 0x8f, 0x4f, 0xc7, 0xc3, 0x41, 0x7d, 0x0f, 0x95, 0x20, 0xdf,
|
||||
0x9d, 0x0e, 0xea, 0x0a, 0x2a, 0x42, 0xee, 0x0c, 0xd7, 0x73, 0xe8, 0x39, 0x68, 0xdd, 0xe9, 0xc0,
|
||||
0xf8, 0x79, 0x3c, 0x1b, 0x19, 0x93, 0xee, 0xac, 0x3f, 0x1a, 0x4f, 0x5f, 0x19, 0x78, 0x78, 0x71,
|
||||
0x76, 0x89, 0xfb, 0xc3, 0x7a, 0xbe, 0xf7, 0xbb, 0x02, 0xaa, 0xc5, 0xbc, 0xad, 0x2d, 0xf7, 0x20,
|
||||
0xee, 0x39, 0x1a, 0xde, 0xb9, 0xf2, 0xcb, 0x0f, 0x12, 0x63, 0x33, 0xd7, 0xa4, 0xb6, 0xce, 0xb8,
|
||||
0xdd, 0xb2, 0x09, 0x15, 0xa3, 0x6d, 0xc5, 0x2e, 0xd3, 0x77, 0x96, 0x9b, 0xff, 0x4c, 0x5e, 0xae,
|
||||
0xad, 0x3f, 0x72, 0xda, 0xab, 0x98, 0xa0, 0xef, 0xb2, 0x70, 0xa1, 0x4f, 0xd6, 0xa9, 0xae, 0x3a,
|
||||
0x7f, 0x26, 0xce, 0x6b, 0xe1, 0xbc, 0x5e, 0x3b, 0xaf, 0xaf, 0x3a, 0xf3, 0xa2, 0x48, 0xd2, 0xf9,
|
||||
0x2f, 0x00, 0x00, 0xff, 0xff, 0x66, 0xb5, 0x16, 0x64, 0x76, 0x09, 0x00, 0x00,
|
||||
}
|
||||
+667
@@ -0,0 +1,667 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/monitoring/v3/alert_service.proto
|
||||
|
||||
package monitoring // import "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import empty "github.com/golang/protobuf/ptypes/empty"
|
||||
import _ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
import field_mask "google.golang.org/genproto/protobuf/field_mask"
|
||||
|
||||
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
|
||||
|
||||
// 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 protocol for the `CreateAlertPolicy` request.
|
||||
type CreateAlertPolicyRequest struct {
|
||||
// The project in which to create the alerting policy. The format is
|
||||
// `projects/[PROJECT_ID]`.
|
||||
//
|
||||
// Note that this field names the parent container in which the alerting
|
||||
// policy will be written, not the name of the created policy. The alerting
|
||||
// policy that is returned will have a name that contains a normalized
|
||||
// representation of this name as a prefix but adds a suffix of the form
|
||||
// `/alertPolicies/[POLICY_ID]`, identifying the policy in the container.
|
||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// The requested alerting policy. You should omit the `name` field in this
|
||||
// policy. The name will be returned in the new policy, including
|
||||
// a new [ALERT_POLICY_ID] value.
|
||||
AlertPolicy *AlertPolicy `protobuf:"bytes,2,opt,name=alert_policy,json=alertPolicy,proto3" json:"alert_policy,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *CreateAlertPolicyRequest) Reset() { *m = CreateAlertPolicyRequest{} }
|
||||
func (m *CreateAlertPolicyRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateAlertPolicyRequest) ProtoMessage() {}
|
||||
func (*CreateAlertPolicyRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_alert_service_04868c382f0d60a7, []int{0}
|
||||
}
|
||||
func (m *CreateAlertPolicyRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_CreateAlertPolicyRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *CreateAlertPolicyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_CreateAlertPolicyRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *CreateAlertPolicyRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_CreateAlertPolicyRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *CreateAlertPolicyRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_CreateAlertPolicyRequest.Size(m)
|
||||
}
|
||||
func (m *CreateAlertPolicyRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_CreateAlertPolicyRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_CreateAlertPolicyRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *CreateAlertPolicyRequest) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CreateAlertPolicyRequest) GetAlertPolicy() *AlertPolicy {
|
||||
if m != nil {
|
||||
return m.AlertPolicy
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// The protocol for the `GetAlertPolicy` request.
|
||||
type GetAlertPolicyRequest struct {
|
||||
// The alerting policy to retrieve. The format is
|
||||
//
|
||||
// projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
|
||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetAlertPolicyRequest) Reset() { *m = GetAlertPolicyRequest{} }
|
||||
func (m *GetAlertPolicyRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetAlertPolicyRequest) ProtoMessage() {}
|
||||
func (*GetAlertPolicyRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_alert_service_04868c382f0d60a7, []int{1}
|
||||
}
|
||||
func (m *GetAlertPolicyRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetAlertPolicyRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetAlertPolicyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetAlertPolicyRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *GetAlertPolicyRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetAlertPolicyRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *GetAlertPolicyRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_GetAlertPolicyRequest.Size(m)
|
||||
}
|
||||
func (m *GetAlertPolicyRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetAlertPolicyRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetAlertPolicyRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *GetAlertPolicyRequest) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// The protocol for the `ListAlertPolicies` request.
|
||||
type ListAlertPoliciesRequest struct {
|
||||
// The project whose alert policies are to be listed. The format is
|
||||
//
|
||||
// projects/[PROJECT_ID]
|
||||
//
|
||||
// Note that this field names the parent container in which the alerting
|
||||
// policies to be listed are stored. To retrieve a single alerting policy
|
||||
// by name, use the
|
||||
// [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy]
|
||||
// operation, instead.
|
||||
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// If provided, this field specifies the criteria that must be met by
|
||||
// alert policies to be included in the response.
|
||||
//
|
||||
// For more details, see [sorting and
|
||||
// filtering](/monitoring/api/v3/sorting-and-filtering).
|
||||
Filter string `protobuf:"bytes,5,opt,name=filter,proto3" json:"filter,omitempty"`
|
||||
// A comma-separated list of fields by which to sort the result. Supports
|
||||
// the same set of field references as the `filter` field. Entries can be
|
||||
// prefixed with a minus sign to sort by the field in descending order.
|
||||
//
|
||||
// For more details, see [sorting and
|
||||
// filtering](/monitoring/api/v3/sorting-and-filtering).
|
||||
OrderBy string `protobuf:"bytes,6,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"`
|
||||
// The maximum number of results to return in a single response.
|
||||
PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
|
||||
// If this field is not empty then it must contain the `nextPageToken` value
|
||||
// returned by a previous call to this method. Using this field causes the
|
||||
// method to return more results from the previous method call.
|
||||
PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListAlertPoliciesRequest) Reset() { *m = ListAlertPoliciesRequest{} }
|
||||
func (m *ListAlertPoliciesRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListAlertPoliciesRequest) ProtoMessage() {}
|
||||
func (*ListAlertPoliciesRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_alert_service_04868c382f0d60a7, []int{2}
|
||||
}
|
||||
func (m *ListAlertPoliciesRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListAlertPoliciesRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListAlertPoliciesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListAlertPoliciesRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ListAlertPoliciesRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListAlertPoliciesRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *ListAlertPoliciesRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_ListAlertPoliciesRequest.Size(m)
|
||||
}
|
||||
func (m *ListAlertPoliciesRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListAlertPoliciesRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListAlertPoliciesRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *ListAlertPoliciesRequest) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ListAlertPoliciesRequest) GetFilter() string {
|
||||
if m != nil {
|
||||
return m.Filter
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ListAlertPoliciesRequest) GetOrderBy() string {
|
||||
if m != nil {
|
||||
return m.OrderBy
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ListAlertPoliciesRequest) GetPageSize() int32 {
|
||||
if m != nil {
|
||||
return m.PageSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ListAlertPoliciesRequest) GetPageToken() string {
|
||||
if m != nil {
|
||||
return m.PageToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// The protocol for the `ListAlertPolicies` response.
|
||||
type ListAlertPoliciesResponse struct {
|
||||
// The returned alert policies.
|
||||
AlertPolicies []*AlertPolicy `protobuf:"bytes,3,rep,name=alert_policies,json=alertPolicies,proto3" json:"alert_policies,omitempty"`
|
||||
// If there might be more results than were returned, then this field is set
|
||||
// to a non-empty value. To see the additional results,
|
||||
// use that value as `pageToken` in the next call to this method.
|
||||
NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListAlertPoliciesResponse) Reset() { *m = ListAlertPoliciesResponse{} }
|
||||
func (m *ListAlertPoliciesResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListAlertPoliciesResponse) ProtoMessage() {}
|
||||
func (*ListAlertPoliciesResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_alert_service_04868c382f0d60a7, []int{3}
|
||||
}
|
||||
func (m *ListAlertPoliciesResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListAlertPoliciesResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListAlertPoliciesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListAlertPoliciesResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ListAlertPoliciesResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListAlertPoliciesResponse.Merge(dst, src)
|
||||
}
|
||||
func (m *ListAlertPoliciesResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_ListAlertPoliciesResponse.Size(m)
|
||||
}
|
||||
func (m *ListAlertPoliciesResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListAlertPoliciesResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListAlertPoliciesResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *ListAlertPoliciesResponse) GetAlertPolicies() []*AlertPolicy {
|
||||
if m != nil {
|
||||
return m.AlertPolicies
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ListAlertPoliciesResponse) GetNextPageToken() string {
|
||||
if m != nil {
|
||||
return m.NextPageToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// The protocol for the `UpdateAlertPolicy` request.
|
||||
type UpdateAlertPolicyRequest struct {
|
||||
// Optional. A list of alerting policy field names. If this field is not
|
||||
// empty, each listed field in the existing alerting policy is set to the
|
||||
// value of the corresponding field in the supplied policy (`alert_policy`),
|
||||
// or to the field's default value if the field is not in the supplied
|
||||
// alerting policy. Fields not listed retain their previous value.
|
||||
//
|
||||
// Examples of valid field masks include `display_name`, `documentation`,
|
||||
// `documentation.content`, `documentation.mime_type`, `user_labels`,
|
||||
// `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc.
|
||||
//
|
||||
// If this field is empty, then the supplied alerting policy replaces the
|
||||
// existing policy. It is the same as deleting the existing policy and
|
||||
// adding the supplied policy, except for the following:
|
||||
//
|
||||
// + The new policy will have the same `[ALERT_POLICY_ID]` as the former
|
||||
// policy. This gives you continuity with the former policy in your
|
||||
// notifications and incidents.
|
||||
// + Conditions in the new policy will keep their former `[CONDITION_ID]` if
|
||||
// the supplied condition includes the `name` field with that
|
||||
// `[CONDITION_ID]`. If the supplied condition omits the `name` field,
|
||||
// then a new `[CONDITION_ID]` is created.
|
||||
UpdateMask *field_mask.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
|
||||
// Required. The updated alerting policy or the updated values for the
|
||||
// fields listed in `update_mask`.
|
||||
// If `update_mask` is not empty, any fields in this policy that are
|
||||
// not in `update_mask` are ignored.
|
||||
AlertPolicy *AlertPolicy `protobuf:"bytes,3,opt,name=alert_policy,json=alertPolicy,proto3" json:"alert_policy,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *UpdateAlertPolicyRequest) Reset() { *m = UpdateAlertPolicyRequest{} }
|
||||
func (m *UpdateAlertPolicyRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*UpdateAlertPolicyRequest) ProtoMessage() {}
|
||||
func (*UpdateAlertPolicyRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_alert_service_04868c382f0d60a7, []int{4}
|
||||
}
|
||||
func (m *UpdateAlertPolicyRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UpdateAlertPolicyRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *UpdateAlertPolicyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_UpdateAlertPolicyRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *UpdateAlertPolicyRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_UpdateAlertPolicyRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *UpdateAlertPolicyRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_UpdateAlertPolicyRequest.Size(m)
|
||||
}
|
||||
func (m *UpdateAlertPolicyRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_UpdateAlertPolicyRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_UpdateAlertPolicyRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *UpdateAlertPolicyRequest) GetUpdateMask() *field_mask.FieldMask {
|
||||
if m != nil {
|
||||
return m.UpdateMask
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UpdateAlertPolicyRequest) GetAlertPolicy() *AlertPolicy {
|
||||
if m != nil {
|
||||
return m.AlertPolicy
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// The protocol for the `DeleteAlertPolicy` request.
|
||||
type DeleteAlertPolicyRequest struct {
|
||||
// The alerting policy to delete. The format is:
|
||||
//
|
||||
// projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
|
||||
//
|
||||
// For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].
|
||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *DeleteAlertPolicyRequest) Reset() { *m = DeleteAlertPolicyRequest{} }
|
||||
func (m *DeleteAlertPolicyRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*DeleteAlertPolicyRequest) ProtoMessage() {}
|
||||
func (*DeleteAlertPolicyRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_alert_service_04868c382f0d60a7, []int{5}
|
||||
}
|
||||
func (m *DeleteAlertPolicyRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_DeleteAlertPolicyRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *DeleteAlertPolicyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_DeleteAlertPolicyRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *DeleteAlertPolicyRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_DeleteAlertPolicyRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *DeleteAlertPolicyRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_DeleteAlertPolicyRequest.Size(m)
|
||||
}
|
||||
func (m *DeleteAlertPolicyRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_DeleteAlertPolicyRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_DeleteAlertPolicyRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *DeleteAlertPolicyRequest) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*CreateAlertPolicyRequest)(nil), "google.monitoring.v3.CreateAlertPolicyRequest")
|
||||
proto.RegisterType((*GetAlertPolicyRequest)(nil), "google.monitoring.v3.GetAlertPolicyRequest")
|
||||
proto.RegisterType((*ListAlertPoliciesRequest)(nil), "google.monitoring.v3.ListAlertPoliciesRequest")
|
||||
proto.RegisterType((*ListAlertPoliciesResponse)(nil), "google.monitoring.v3.ListAlertPoliciesResponse")
|
||||
proto.RegisterType((*UpdateAlertPolicyRequest)(nil), "google.monitoring.v3.UpdateAlertPolicyRequest")
|
||||
proto.RegisterType((*DeleteAlertPolicyRequest)(nil), "google.monitoring.v3.DeleteAlertPolicyRequest")
|
||||
}
|
||||
|
||||
// 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.SupportPackageIsVersion4
|
||||
|
||||
// AlertPolicyServiceClient is the client API for AlertPolicyService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type AlertPolicyServiceClient interface {
|
||||
// Lists the existing alerting policies for the project.
|
||||
ListAlertPolicies(ctx context.Context, in *ListAlertPoliciesRequest, opts ...grpc.CallOption) (*ListAlertPoliciesResponse, error)
|
||||
// Gets a single alerting policy.
|
||||
GetAlertPolicy(ctx context.Context, in *GetAlertPolicyRequest, opts ...grpc.CallOption) (*AlertPolicy, error)
|
||||
// Creates a new alerting policy.
|
||||
CreateAlertPolicy(ctx context.Context, in *CreateAlertPolicyRequest, opts ...grpc.CallOption) (*AlertPolicy, error)
|
||||
// Deletes an alerting policy.
|
||||
DeleteAlertPolicy(ctx context.Context, in *DeleteAlertPolicyRequest, opts ...grpc.CallOption) (*empty.Empty, error)
|
||||
// Updates an alerting policy. You can either replace the entire policy with
|
||||
// a new one or replace only certain fields in the current alerting policy by
|
||||
// specifying the fields to be updated via `updateMask`. Returns the
|
||||
// updated alerting policy.
|
||||
UpdateAlertPolicy(ctx context.Context, in *UpdateAlertPolicyRequest, opts ...grpc.CallOption) (*AlertPolicy, error)
|
||||
}
|
||||
|
||||
type alertPolicyServiceClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewAlertPolicyServiceClient(cc *grpc.ClientConn) AlertPolicyServiceClient {
|
||||
return &alertPolicyServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *alertPolicyServiceClient) ListAlertPolicies(ctx context.Context, in *ListAlertPoliciesRequest, opts ...grpc.CallOption) (*ListAlertPoliciesResponse, error) {
|
||||
out := new(ListAlertPoliciesResponse)
|
||||
err := c.cc.Invoke(ctx, "/google.monitoring.v3.AlertPolicyService/ListAlertPolicies", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *alertPolicyServiceClient) GetAlertPolicy(ctx context.Context, in *GetAlertPolicyRequest, opts ...grpc.CallOption) (*AlertPolicy, error) {
|
||||
out := new(AlertPolicy)
|
||||
err := c.cc.Invoke(ctx, "/google.monitoring.v3.AlertPolicyService/GetAlertPolicy", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *alertPolicyServiceClient) CreateAlertPolicy(ctx context.Context, in *CreateAlertPolicyRequest, opts ...grpc.CallOption) (*AlertPolicy, error) {
|
||||
out := new(AlertPolicy)
|
||||
err := c.cc.Invoke(ctx, "/google.monitoring.v3.AlertPolicyService/CreateAlertPolicy", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *alertPolicyServiceClient) DeleteAlertPolicy(ctx context.Context, in *DeleteAlertPolicyRequest, opts ...grpc.CallOption) (*empty.Empty, error) {
|
||||
out := new(empty.Empty)
|
||||
err := c.cc.Invoke(ctx, "/google.monitoring.v3.AlertPolicyService/DeleteAlertPolicy", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *alertPolicyServiceClient) UpdateAlertPolicy(ctx context.Context, in *UpdateAlertPolicyRequest, opts ...grpc.CallOption) (*AlertPolicy, error) {
|
||||
out := new(AlertPolicy)
|
||||
err := c.cc.Invoke(ctx, "/google.monitoring.v3.AlertPolicyService/UpdateAlertPolicy", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// AlertPolicyServiceServer is the server API for AlertPolicyService service.
|
||||
type AlertPolicyServiceServer interface {
|
||||
// Lists the existing alerting policies for the project.
|
||||
ListAlertPolicies(context.Context, *ListAlertPoliciesRequest) (*ListAlertPoliciesResponse, error)
|
||||
// Gets a single alerting policy.
|
||||
GetAlertPolicy(context.Context, *GetAlertPolicyRequest) (*AlertPolicy, error)
|
||||
// Creates a new alerting policy.
|
||||
CreateAlertPolicy(context.Context, *CreateAlertPolicyRequest) (*AlertPolicy, error)
|
||||
// Deletes an alerting policy.
|
||||
DeleteAlertPolicy(context.Context, *DeleteAlertPolicyRequest) (*empty.Empty, error)
|
||||
// Updates an alerting policy. You can either replace the entire policy with
|
||||
// a new one or replace only certain fields in the current alerting policy by
|
||||
// specifying the fields to be updated via `updateMask`. Returns the
|
||||
// updated alerting policy.
|
||||
UpdateAlertPolicy(context.Context, *UpdateAlertPolicyRequest) (*AlertPolicy, error)
|
||||
}
|
||||
|
||||
func RegisterAlertPolicyServiceServer(s *grpc.Server, srv AlertPolicyServiceServer) {
|
||||
s.RegisterService(&_AlertPolicyService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _AlertPolicyService_ListAlertPolicies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListAlertPoliciesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AlertPolicyServiceServer).ListAlertPolicies(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.monitoring.v3.AlertPolicyService/ListAlertPolicies",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AlertPolicyServiceServer).ListAlertPolicies(ctx, req.(*ListAlertPoliciesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AlertPolicyService_GetAlertPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetAlertPolicyRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AlertPolicyServiceServer).GetAlertPolicy(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.monitoring.v3.AlertPolicyService/GetAlertPolicy",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AlertPolicyServiceServer).GetAlertPolicy(ctx, req.(*GetAlertPolicyRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AlertPolicyService_CreateAlertPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateAlertPolicyRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AlertPolicyServiceServer).CreateAlertPolicy(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.monitoring.v3.AlertPolicyService/CreateAlertPolicy",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AlertPolicyServiceServer).CreateAlertPolicy(ctx, req.(*CreateAlertPolicyRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AlertPolicyService_DeleteAlertPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteAlertPolicyRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AlertPolicyServiceServer).DeleteAlertPolicy(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.monitoring.v3.AlertPolicyService/DeleteAlertPolicy",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AlertPolicyServiceServer).DeleteAlertPolicy(ctx, req.(*DeleteAlertPolicyRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AlertPolicyService_UpdateAlertPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateAlertPolicyRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AlertPolicyServiceServer).UpdateAlertPolicy(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.monitoring.v3.AlertPolicyService/UpdateAlertPolicy",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AlertPolicyServiceServer).UpdateAlertPolicy(ctx, req.(*UpdateAlertPolicyRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _AlertPolicyService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "google.monitoring.v3.AlertPolicyService",
|
||||
HandlerType: (*AlertPolicyServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "ListAlertPolicies",
|
||||
Handler: _AlertPolicyService_ListAlertPolicies_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetAlertPolicy",
|
||||
Handler: _AlertPolicyService_GetAlertPolicy_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateAlertPolicy",
|
||||
Handler: _AlertPolicyService_CreateAlertPolicy_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteAlertPolicy",
|
||||
Handler: _AlertPolicyService_DeleteAlertPolicy_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateAlertPolicy",
|
||||
Handler: _AlertPolicyService_UpdateAlertPolicy_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "google/monitoring/v3/alert_service.proto",
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google/monitoring/v3/alert_service.proto", fileDescriptor_alert_service_04868c382f0d60a7)
|
||||
}
|
||||
|
||||
var fileDescriptor_alert_service_04868c382f0d60a7 = []byte{
|
||||
// 656 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x41, 0x6f, 0xd3, 0x4c,
|
||||
0x10, 0x95, 0x93, 0x36, 0x5f, 0xbb, 0xfd, 0x5a, 0x94, 0x15, 0x54, 0xae, 0x0b, 0x52, 0x30, 0x2a,
|
||||
0x54, 0xad, 0xb0, 0xa5, 0xf8, 0x04, 0x15, 0x48, 0xa4, 0x85, 0xf6, 0x40, 0xa5, 0x28, 0x85, 0x1e,
|
||||
0x50, 0xa4, 0x68, 0x93, 0x4c, 0xac, 0x25, 0x8e, 0xd7, 0x78, 0x37, 0x11, 0x29, 0xea, 0x85, 0x23,
|
||||
0x12, 0xe2, 0xc0, 0x99, 0x03, 0x47, 0x38, 0x20, 0x7e, 0x07, 0x57, 0xfe, 0x02, 0x3f, 0x04, 0x79,
|
||||
0xed, 0x34, 0x76, 0x6d, 0xab, 0x16, 0xb7, 0xcc, 0xce, 0xdb, 0x99, 0xb7, 0x6f, 0xde, 0x38, 0x68,
|
||||
0xdb, 0x66, 0xcc, 0x76, 0xc0, 0x1c, 0x31, 0x97, 0x0a, 0xe6, 0x53, 0xd7, 0x36, 0x27, 0x96, 0x49,
|
||||
0x1c, 0xf0, 0x45, 0x87, 0x83, 0x3f, 0xa1, 0x3d, 0x30, 0x3c, 0x9f, 0x09, 0x86, 0xaf, 0x87, 0x48,
|
||||
0x63, 0x8e, 0x34, 0x26, 0x96, 0x76, 0x33, 0xba, 0x4f, 0x3c, 0x6a, 0x12, 0xd7, 0x65, 0x82, 0x08,
|
||||
0xca, 0x5c, 0x1e, 0xde, 0xd1, 0x6a, 0xf9, 0xd5, 0x23, 0xc4, 0x66, 0x84, 0x90, 0x51, 0x77, 0x3c,
|
||||
0x30, 0x61, 0xe4, 0x89, 0xe9, 0xa5, 0xeb, 0x17, 0xc9, 0x01, 0x05, 0xa7, 0xdf, 0x19, 0x11, 0x3e,
|
||||
0x0c, 0x11, 0xba, 0x40, 0xea, 0xbe, 0x0f, 0x44, 0xc0, 0x93, 0xa0, 0x66, 0x93, 0x39, 0xb4, 0x37,
|
||||
0x6d, 0xc1, 0x9b, 0x31, 0x70, 0x81, 0x31, 0x5a, 0x70, 0xc9, 0x08, 0xd4, 0x72, 0x4d, 0xd9, 0x5e,
|
||||
0x6e, 0xc9, 0xdf, 0xf8, 0x00, 0xfd, 0x1f, 0xbe, 0xcd, 0x93, 0x50, 0xb5, 0x54, 0x53, 0xb6, 0x57,
|
||||
0xea, 0xb7, 0x8d, 0xac, 0xb7, 0x19, 0xf1, 0x9a, 0x2b, 0x64, 0x1e, 0xe8, 0xbb, 0xe8, 0xc6, 0x21,
|
||||
0x88, 0x62, 0x2d, 0xf5, 0x2f, 0x0a, 0x52, 0x9f, 0x53, 0x1e, 0x83, 0x53, 0xe0, 0x97, 0x2f, 0x2c,
|
||||
0xc4, 0x38, 0xae, 0xa3, 0xca, 0x80, 0x3a, 0x02, 0x7c, 0x75, 0x51, 0x9e, 0x46, 0x11, 0xde, 0x40,
|
||||
0x4b, 0xcc, 0xef, 0x83, 0xdf, 0xe9, 0x4e, 0xd5, 0x8a, 0xcc, 0xfc, 0x27, 0xe3, 0xc6, 0x14, 0x6f,
|
||||
0xa2, 0x65, 0x8f, 0xd8, 0xd0, 0xe1, 0xf4, 0x0c, 0xe4, 0x9b, 0x16, 0x5b, 0x4b, 0xc1, 0xc1, 0x09,
|
||||
0x3d, 0x03, 0x7c, 0x0b, 0x21, 0x99, 0x14, 0x6c, 0x08, 0x6e, 0x44, 0x4d, 0xc2, 0x5f, 0x04, 0x07,
|
||||
0xfa, 0x47, 0x05, 0x6d, 0x64, 0xf0, 0xe3, 0x1e, 0x73, 0x39, 0xe0, 0x23, 0xb4, 0x16, 0x13, 0x8c,
|
||||
0x02, 0x57, 0xcb, 0xb5, 0x72, 0x31, 0xc9, 0x56, 0x49, 0xbc, 0x22, 0xbe, 0x8b, 0xae, 0xb9, 0xf0,
|
||||
0x56, 0x74, 0x62, 0x5c, 0x4a, 0x92, 0xcb, 0x6a, 0x70, 0xdc, 0xbc, 0xe0, 0x13, 0xe8, 0xf5, 0xd2,
|
||||
0xeb, 0x67, 0xcf, 0x74, 0x0f, 0xad, 0x8c, 0x65, 0x4e, 0x9a, 0x20, 0x1a, 0x9f, 0x36, 0xe3, 0x32,
|
||||
0xf3, 0x89, 0xf1, 0x2c, 0xf0, 0xc9, 0x31, 0xe1, 0xc3, 0x16, 0x0a, 0xe1, 0xc1, 0xef, 0xd4, 0xf0,
|
||||
0xcb, 0xff, 0x34, 0x7c, 0x03, 0xa9, 0x07, 0xe0, 0x40, 0x51, 0xcb, 0xd5, 0x7f, 0x54, 0x10, 0x8e,
|
||||
0x41, 0x4f, 0xc2, 0xa5, 0xc2, 0x5f, 0x15, 0x54, 0x4d, 0xc9, 0x8e, 0x8d, 0x6c, 0x32, 0x79, 0xfe,
|
||||
0xd1, 0xcc, 0xc2, 0xf8, 0x70, 0x9e, 0xfa, 0xee, 0xfb, 0xdf, 0x7f, 0x3e, 0x97, 0xb6, 0xf0, 0x9d,
|
||||
0x60, 0x11, 0xdf, 0x05, 0x04, 0x1f, 0x79, 0x3e, 0x7b, 0x0d, 0x3d, 0xc1, 0xcd, 0x9d, 0x73, 0x33,
|
||||
0x39, 0xb2, 0x4f, 0x0a, 0x5a, 0x4b, 0x1a, 0x1d, 0xef, 0x66, 0x37, 0xcc, 0x5c, 0x07, 0xed, 0x6a,
|
||||
0x69, 0xf5, 0xfb, 0x92, 0xcf, 0x3d, 0xbc, 0x95, 0xc5, 0x27, 0x49, 0xc7, 0xdc, 0x39, 0x97, 0xaa,
|
||||
0xa5, 0x16, 0x3e, 0x4f, 0xb5, 0xbc, 0x2f, 0x43, 0x11, 0x5e, 0x0f, 0x24, 0x2f, 0x4b, 0x2f, 0xa2,
|
||||
0xd3, 0xc3, 0x84, 0xad, 0xf0, 0x07, 0x05, 0x55, 0x53, 0x0e, 0xc9, 0xe3, 0x98, 0x67, 0x25, 0x6d,
|
||||
0x3d, 0x65, 0xea, 0xa7, 0xc1, 0x97, 0x71, 0x26, 0xd8, 0x4e, 0x41, 0xc1, 0x7e, 0x2a, 0xa8, 0x9a,
|
||||
0xda, 0xa6, 0x3c, 0x32, 0x79, 0x6b, 0x57, 0x44, 0xb0, 0x23, 0xc9, 0xab, 0x51, 0xaf, 0x4b, 0x5e,
|
||||
0x71, 0x41, 0x8c, 0xab, 0x48, 0x26, 0xf5, 0x6b, 0x7c, 0x53, 0x90, 0xda, 0x63, 0xa3, 0xcc, 0x96,
|
||||
0x8d, 0xaa, 0xec, 0x19, 0x2d, 0x51, 0x33, 0x90, 0xa6, 0xa9, 0xbc, 0x7a, 0x1c, 0x41, 0x6d, 0xe6,
|
||||
0x10, 0xd7, 0x36, 0x98, 0x6f, 0x9b, 0x36, 0xb8, 0x52, 0x38, 0x33, 0x4c, 0x11, 0x8f, 0xf2, 0xe4,
|
||||
0xbf, 0xd0, 0xde, 0x3c, 0xfa, 0x5e, 0xd2, 0x0e, 0xc3, 0x02, 0xfb, 0x0e, 0x1b, 0xf7, 0x8d, 0xe3,
|
||||
0x79, 0xc7, 0x53, 0xeb, 0xd7, 0x2c, 0xd9, 0x96, 0xc9, 0xf6, 0x3c, 0xd9, 0x3e, 0xb5, 0xba, 0x15,
|
||||
0xd9, 0xc4, 0xfa, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x6f, 0x1f, 0xe6, 0xf0, 0x47, 0x07, 0x00, 0x00,
|
||||
}
|
||||
+887
@@ -0,0 +1,887 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/monitoring/v3/common.proto
|
||||
|
||||
package monitoring // import "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import duration "github.com/golang/protobuf/ptypes/duration"
|
||||
import timestamp "github.com/golang/protobuf/ptypes/timestamp"
|
||||
import _ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
import distribution "google.golang.org/genproto/googleapis/api/distribution"
|
||||
|
||||
// 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
|
||||
|
||||
// Specifies an ordering relationship on two arguments, here called left and
|
||||
// right.
|
||||
type ComparisonType int32
|
||||
|
||||
const (
|
||||
// No ordering relationship is specified.
|
||||
ComparisonType_COMPARISON_UNSPECIFIED ComparisonType = 0
|
||||
// The left argument is greater than the right argument.
|
||||
ComparisonType_COMPARISON_GT ComparisonType = 1
|
||||
// The left argument is greater than or equal to the right argument.
|
||||
ComparisonType_COMPARISON_GE ComparisonType = 2
|
||||
// The left argument is less than the right argument.
|
||||
ComparisonType_COMPARISON_LT ComparisonType = 3
|
||||
// The left argument is less than or equal to the right argument.
|
||||
ComparisonType_COMPARISON_LE ComparisonType = 4
|
||||
// The left argument is equal to the right argument.
|
||||
ComparisonType_COMPARISON_EQ ComparisonType = 5
|
||||
// The left argument is not equal to the right argument.
|
||||
ComparisonType_COMPARISON_NE ComparisonType = 6
|
||||
)
|
||||
|
||||
var ComparisonType_name = map[int32]string{
|
||||
0: "COMPARISON_UNSPECIFIED",
|
||||
1: "COMPARISON_GT",
|
||||
2: "COMPARISON_GE",
|
||||
3: "COMPARISON_LT",
|
||||
4: "COMPARISON_LE",
|
||||
5: "COMPARISON_EQ",
|
||||
6: "COMPARISON_NE",
|
||||
}
|
||||
var ComparisonType_value = map[string]int32{
|
||||
"COMPARISON_UNSPECIFIED": 0,
|
||||
"COMPARISON_GT": 1,
|
||||
"COMPARISON_GE": 2,
|
||||
"COMPARISON_LT": 3,
|
||||
"COMPARISON_LE": 4,
|
||||
"COMPARISON_EQ": 5,
|
||||
"COMPARISON_NE": 6,
|
||||
}
|
||||
|
||||
func (x ComparisonType) String() string {
|
||||
return proto.EnumName(ComparisonType_name, int32(x))
|
||||
}
|
||||
func (ComparisonType) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_common_bd839df590cb6820, []int{0}
|
||||
}
|
||||
|
||||
// The tier of service for a Stackdriver account. Please see the
|
||||
// [service tiers documentation](https://cloud.google.com/monitoring/accounts/tiers)
|
||||
// for more details.
|
||||
type ServiceTier int32 // Deprecated: Do not use.
|
||||
const (
|
||||
// An invalid sentinel value, used to indicate that a tier has not
|
||||
// been provided explicitly.
|
||||
ServiceTier_SERVICE_TIER_UNSPECIFIED ServiceTier = 0
|
||||
// The Stackdriver Basic tier, a free tier of service that provides basic
|
||||
// features, a moderate allotment of logs, and access to built-in metrics.
|
||||
// A number of features are not available in this tier. For more details,
|
||||
// see [the service tiers documentation](https://cloud.google.com/monitoring/accounts/tiers).
|
||||
ServiceTier_SERVICE_TIER_BASIC ServiceTier = 1
|
||||
// The Stackdriver Premium tier, a higher, more expensive tier of service
|
||||
// that provides access to all Stackdriver features, lets you use Stackdriver
|
||||
// with AWS accounts, and has a larger allotments for logs and metrics. For
|
||||
// more details, see [the service tiers documentation](https://cloud.google.com/monitoring/accounts/tiers).
|
||||
ServiceTier_SERVICE_TIER_PREMIUM ServiceTier = 2
|
||||
)
|
||||
|
||||
var ServiceTier_name = map[int32]string{
|
||||
0: "SERVICE_TIER_UNSPECIFIED",
|
||||
1: "SERVICE_TIER_BASIC",
|
||||
2: "SERVICE_TIER_PREMIUM",
|
||||
}
|
||||
var ServiceTier_value = map[string]int32{
|
||||
"SERVICE_TIER_UNSPECIFIED": 0,
|
||||
"SERVICE_TIER_BASIC": 1,
|
||||
"SERVICE_TIER_PREMIUM": 2,
|
||||
}
|
||||
|
||||
func (x ServiceTier) String() string {
|
||||
return proto.EnumName(ServiceTier_name, int32(x))
|
||||
}
|
||||
func (ServiceTier) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_common_bd839df590cb6820, []int{1}
|
||||
}
|
||||
|
||||
// The Aligner describes how to bring the data points in a single
|
||||
// time series into temporal alignment.
|
||||
type Aggregation_Aligner int32
|
||||
|
||||
const (
|
||||
// No alignment. Raw data is returned. Not valid if cross-time
|
||||
// series reduction is requested. The value type of the result is
|
||||
// the same as the value type of the input.
|
||||
Aggregation_ALIGN_NONE Aggregation_Aligner = 0
|
||||
// Align and convert to delta metric type. This alignment is valid
|
||||
// for cumulative metrics and delta metrics. Aligning an existing
|
||||
// delta metric to a delta metric requires that the alignment
|
||||
// period be increased. The value type of the result is the same
|
||||
// as the value type of the input.
|
||||
//
|
||||
// One can think of this aligner as a rate but without time units; that
|
||||
// is, the output is conceptually (second_point - first_point).
|
||||
Aggregation_ALIGN_DELTA Aggregation_Aligner = 1
|
||||
// Align and convert to a rate. This alignment is valid for
|
||||
// cumulative metrics and delta metrics with numeric values. The output is a
|
||||
// gauge metric with value type
|
||||
// [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE].
|
||||
//
|
||||
// One can think of this aligner as conceptually providing the slope of
|
||||
// the line that passes through the value at the start and end of the
|
||||
// window. In other words, this is conceptually ((y1 - y0)/(t1 - t0)),
|
||||
// and the output unit is one that has a "/time" dimension.
|
||||
//
|
||||
// If, by rate, you are looking for percentage change, see the
|
||||
// `ALIGN_PERCENT_CHANGE` aligner option.
|
||||
Aggregation_ALIGN_RATE Aggregation_Aligner = 2
|
||||
// Align by interpolating between adjacent points around the
|
||||
// period boundary. This alignment is valid for gauge
|
||||
// metrics with numeric values. The value type of the result is the same
|
||||
// as the value type of the input.
|
||||
Aggregation_ALIGN_INTERPOLATE Aggregation_Aligner = 3
|
||||
// Align by shifting the oldest data point before the period
|
||||
// boundary to the boundary. This alignment is valid for gauge
|
||||
// metrics. The value type of the result is the same as the
|
||||
// value type of the input.
|
||||
Aggregation_ALIGN_NEXT_OLDER Aggregation_Aligner = 4
|
||||
// Align time series via aggregation. The resulting data point in
|
||||
// the alignment period is the minimum of all data points in the
|
||||
// period. This alignment is valid for gauge and delta metrics with numeric
|
||||
// values. The value type of the result is the same as the value
|
||||
// type of the input.
|
||||
Aggregation_ALIGN_MIN Aggregation_Aligner = 10
|
||||
// Align time series via aggregation. The resulting data point in
|
||||
// the alignment period is the maximum of all data points in the
|
||||
// period. This alignment is valid for gauge and delta metrics with numeric
|
||||
// values. The value type of the result is the same as the value
|
||||
// type of the input.
|
||||
Aggregation_ALIGN_MAX Aggregation_Aligner = 11
|
||||
// Align time series via aggregation. The resulting data point in
|
||||
// the alignment period is the average or arithmetic mean of all
|
||||
// data points in the period. This alignment is valid for gauge and delta
|
||||
// metrics with numeric values. The value type of the output is
|
||||
// [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE].
|
||||
Aggregation_ALIGN_MEAN Aggregation_Aligner = 12
|
||||
// Align time series via aggregation. The resulting data point in
|
||||
// the alignment period is the count of all data points in the
|
||||
// period. This alignment is valid for gauge and delta metrics with numeric
|
||||
// or Boolean values. The value type of the output is
|
||||
// [INT64][google.api.MetricDescriptor.ValueType.INT64].
|
||||
Aggregation_ALIGN_COUNT Aggregation_Aligner = 13
|
||||
// Align time series via aggregation. The resulting data point in
|
||||
// the alignment period is the sum of all data points in the
|
||||
// period. This alignment is valid for gauge and delta metrics with numeric
|
||||
// and distribution values. The value type of the output is the
|
||||
// same as the value type of the input.
|
||||
Aggregation_ALIGN_SUM Aggregation_Aligner = 14
|
||||
// Align time series via aggregation. The resulting data point in
|
||||
// the alignment period is the standard deviation of all data
|
||||
// points in the period. This alignment is valid for gauge and delta metrics
|
||||
// with numeric values. The value type of the output is
|
||||
// [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE].
|
||||
Aggregation_ALIGN_STDDEV Aggregation_Aligner = 15
|
||||
// Align time series via aggregation. The resulting data point in
|
||||
// the alignment period is the count of True-valued data points in the
|
||||
// period. This alignment is valid for gauge metrics with
|
||||
// Boolean values. The value type of the output is
|
||||
// [INT64][google.api.MetricDescriptor.ValueType.INT64].
|
||||
Aggregation_ALIGN_COUNT_TRUE Aggregation_Aligner = 16
|
||||
// Align time series via aggregation. The resulting data point in
|
||||
// the alignment period is the count of False-valued data points in the
|
||||
// period. This alignment is valid for gauge metrics with
|
||||
// Boolean values. The value type of the output is
|
||||
// [INT64][google.api.MetricDescriptor.ValueType.INT64].
|
||||
Aggregation_ALIGN_COUNT_FALSE Aggregation_Aligner = 24
|
||||
// Align time series via aggregation. The resulting data point in
|
||||
// the alignment period is the fraction of True-valued data points in the
|
||||
// period. This alignment is valid for gauge metrics with Boolean values.
|
||||
// The output value is in the range [0, 1] and has value type
|
||||
// [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE].
|
||||
Aggregation_ALIGN_FRACTION_TRUE Aggregation_Aligner = 17
|
||||
// Align time series via aggregation. The resulting data point in
|
||||
// the alignment period is the 99th percentile of all data
|
||||
// points in the period. This alignment is valid for gauge and delta metrics
|
||||
// with distribution values. The output is a gauge metric with value type
|
||||
// [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE].
|
||||
Aggregation_ALIGN_PERCENTILE_99 Aggregation_Aligner = 18
|
||||
// Align time series via aggregation. The resulting data point in
|
||||
// the alignment period is the 95th percentile of all data
|
||||
// points in the period. This alignment is valid for gauge and delta metrics
|
||||
// with distribution values. The output is a gauge metric with value type
|
||||
// [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE].
|
||||
Aggregation_ALIGN_PERCENTILE_95 Aggregation_Aligner = 19
|
||||
// Align time series via aggregation. The resulting data point in
|
||||
// the alignment period is the 50th percentile of all data
|
||||
// points in the period. This alignment is valid for gauge and delta metrics
|
||||
// with distribution values. The output is a gauge metric with value type
|
||||
// [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE].
|
||||
Aggregation_ALIGN_PERCENTILE_50 Aggregation_Aligner = 20
|
||||
// Align time series via aggregation. The resulting data point in
|
||||
// the alignment period is the 5th percentile of all data
|
||||
// points in the period. This alignment is valid for gauge and delta metrics
|
||||
// with distribution values. The output is a gauge metric with value type
|
||||
// [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE].
|
||||
Aggregation_ALIGN_PERCENTILE_05 Aggregation_Aligner = 21
|
||||
// Align and convert to a percentage change. This alignment is valid for
|
||||
// gauge and delta metrics with numeric values. This alignment conceptually
|
||||
// computes the equivalent of "((current - previous)/previous)*100"
|
||||
// where previous value is determined based on the alignmentPeriod.
|
||||
// In the event that previous is 0 the calculated value is infinity with the
|
||||
// exception that if both (current - previous) and previous are 0 the
|
||||
// calculated value is 0.
|
||||
// A 10 minute moving mean is computed at each point of the time window
|
||||
// prior to the above calculation to smooth the metric and prevent false
|
||||
// positives from very short lived spikes.
|
||||
// Only applicable for data that is >= 0. Any values < 0 are treated as
|
||||
// no data. While delta metrics are accepted by this alignment special care
|
||||
// should be taken that the values for the metric will always be positive.
|
||||
// The output is a gauge metric with value type
|
||||
// [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE].
|
||||
Aggregation_ALIGN_PERCENT_CHANGE Aggregation_Aligner = 23
|
||||
)
|
||||
|
||||
var Aggregation_Aligner_name = map[int32]string{
|
||||
0: "ALIGN_NONE",
|
||||
1: "ALIGN_DELTA",
|
||||
2: "ALIGN_RATE",
|
||||
3: "ALIGN_INTERPOLATE",
|
||||
4: "ALIGN_NEXT_OLDER",
|
||||
10: "ALIGN_MIN",
|
||||
11: "ALIGN_MAX",
|
||||
12: "ALIGN_MEAN",
|
||||
13: "ALIGN_COUNT",
|
||||
14: "ALIGN_SUM",
|
||||
15: "ALIGN_STDDEV",
|
||||
16: "ALIGN_COUNT_TRUE",
|
||||
24: "ALIGN_COUNT_FALSE",
|
||||
17: "ALIGN_FRACTION_TRUE",
|
||||
18: "ALIGN_PERCENTILE_99",
|
||||
19: "ALIGN_PERCENTILE_95",
|
||||
20: "ALIGN_PERCENTILE_50",
|
||||
21: "ALIGN_PERCENTILE_05",
|
||||
23: "ALIGN_PERCENT_CHANGE",
|
||||
}
|
||||
var Aggregation_Aligner_value = map[string]int32{
|
||||
"ALIGN_NONE": 0,
|
||||
"ALIGN_DELTA": 1,
|
||||
"ALIGN_RATE": 2,
|
||||
"ALIGN_INTERPOLATE": 3,
|
||||
"ALIGN_NEXT_OLDER": 4,
|
||||
"ALIGN_MIN": 10,
|
||||
"ALIGN_MAX": 11,
|
||||
"ALIGN_MEAN": 12,
|
||||
"ALIGN_COUNT": 13,
|
||||
"ALIGN_SUM": 14,
|
||||
"ALIGN_STDDEV": 15,
|
||||
"ALIGN_COUNT_TRUE": 16,
|
||||
"ALIGN_COUNT_FALSE": 24,
|
||||
"ALIGN_FRACTION_TRUE": 17,
|
||||
"ALIGN_PERCENTILE_99": 18,
|
||||
"ALIGN_PERCENTILE_95": 19,
|
||||
"ALIGN_PERCENTILE_50": 20,
|
||||
"ALIGN_PERCENTILE_05": 21,
|
||||
"ALIGN_PERCENT_CHANGE": 23,
|
||||
}
|
||||
|
||||
func (x Aggregation_Aligner) String() string {
|
||||
return proto.EnumName(Aggregation_Aligner_name, int32(x))
|
||||
}
|
||||
func (Aggregation_Aligner) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_common_bd839df590cb6820, []int{2, 0}
|
||||
}
|
||||
|
||||
// A Reducer describes how to aggregate data points from multiple
|
||||
// time series into a single time series.
|
||||
type Aggregation_Reducer int32
|
||||
|
||||
const (
|
||||
// No cross-time series reduction. The output of the aligner is
|
||||
// returned.
|
||||
Aggregation_REDUCE_NONE Aggregation_Reducer = 0
|
||||
// Reduce by computing the mean across time series for each
|
||||
// alignment period. This reducer is valid for delta and
|
||||
// gauge metrics with numeric or distribution values. The value type of the
|
||||
// output is [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE].
|
||||
Aggregation_REDUCE_MEAN Aggregation_Reducer = 1
|
||||
// Reduce by computing the minimum across time series for each
|
||||
// alignment period. This reducer is valid for delta and
|
||||
// gauge metrics with numeric values. The value type of the output
|
||||
// is the same as the value type of the input.
|
||||
Aggregation_REDUCE_MIN Aggregation_Reducer = 2
|
||||
// Reduce by computing the maximum across time series for each
|
||||
// alignment period. This reducer is valid for delta and
|
||||
// gauge metrics with numeric values. The value type of the output
|
||||
// is the same as the value type of the input.
|
||||
Aggregation_REDUCE_MAX Aggregation_Reducer = 3
|
||||
// Reduce by computing the sum across time series for each
|
||||
// alignment period. This reducer is valid for delta and
|
||||
// gauge metrics with numeric and distribution values. The value type of
|
||||
// the output is the same as the value type of the input.
|
||||
Aggregation_REDUCE_SUM Aggregation_Reducer = 4
|
||||
// Reduce by computing the standard deviation across time series
|
||||
// for each alignment period. This reducer is valid for delta
|
||||
// and gauge metrics with numeric or distribution values. The value type of
|
||||
// the output is [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE].
|
||||
Aggregation_REDUCE_STDDEV Aggregation_Reducer = 5
|
||||
// Reduce by computing the count of data points across time series
|
||||
// for each alignment period. This reducer is valid for delta
|
||||
// and gauge metrics of numeric, Boolean, distribution, and string value
|
||||
// type. The value type of the output is
|
||||
// [INT64][google.api.MetricDescriptor.ValueType.INT64].
|
||||
Aggregation_REDUCE_COUNT Aggregation_Reducer = 6
|
||||
// Reduce by computing the count of True-valued data points across time
|
||||
// series for each alignment period. This reducer is valid for delta
|
||||
// and gauge metrics of Boolean value type. The value type of
|
||||
// the output is [INT64][google.api.MetricDescriptor.ValueType.INT64].
|
||||
Aggregation_REDUCE_COUNT_TRUE Aggregation_Reducer = 7
|
||||
// Reduce by computing the count of False-valued data points across time
|
||||
// series for each alignment period. This reducer is valid for delta
|
||||
// and gauge metrics of Boolean value type. The value type of
|
||||
// the output is [INT64][google.api.MetricDescriptor.ValueType.INT64].
|
||||
Aggregation_REDUCE_COUNT_FALSE Aggregation_Reducer = 15
|
||||
// Reduce by computing the fraction of True-valued data points across time
|
||||
// series for each alignment period. This reducer is valid for delta
|
||||
// and gauge metrics of Boolean value type. The output value is in the
|
||||
// range [0, 1] and has value type
|
||||
// [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE].
|
||||
Aggregation_REDUCE_FRACTION_TRUE Aggregation_Reducer = 8
|
||||
// Reduce by computing 99th percentile of data points across time series
|
||||
// for each alignment period. This reducer is valid for gauge and delta
|
||||
// metrics of numeric and distribution type. The value of the output is
|
||||
// [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]
|
||||
Aggregation_REDUCE_PERCENTILE_99 Aggregation_Reducer = 9
|
||||
// Reduce by computing 95th percentile of data points across time series
|
||||
// for each alignment period. This reducer is valid for gauge and delta
|
||||
// metrics of numeric and distribution type. The value of the output is
|
||||
// [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]
|
||||
Aggregation_REDUCE_PERCENTILE_95 Aggregation_Reducer = 10
|
||||
// Reduce by computing 50th percentile of data points across time series
|
||||
// for each alignment period. This reducer is valid for gauge and delta
|
||||
// metrics of numeric and distribution type. The value of the output is
|
||||
// [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]
|
||||
Aggregation_REDUCE_PERCENTILE_50 Aggregation_Reducer = 11
|
||||
// Reduce by computing 5th percentile of data points across time series
|
||||
// for each alignment period. This reducer is valid for gauge and delta
|
||||
// metrics of numeric and distribution type. The value of the output is
|
||||
// [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]
|
||||
Aggregation_REDUCE_PERCENTILE_05 Aggregation_Reducer = 12
|
||||
)
|
||||
|
||||
var Aggregation_Reducer_name = map[int32]string{
|
||||
0: "REDUCE_NONE",
|
||||
1: "REDUCE_MEAN",
|
||||
2: "REDUCE_MIN",
|
||||
3: "REDUCE_MAX",
|
||||
4: "REDUCE_SUM",
|
||||
5: "REDUCE_STDDEV",
|
||||
6: "REDUCE_COUNT",
|
||||
7: "REDUCE_COUNT_TRUE",
|
||||
15: "REDUCE_COUNT_FALSE",
|
||||
8: "REDUCE_FRACTION_TRUE",
|
||||
9: "REDUCE_PERCENTILE_99",
|
||||
10: "REDUCE_PERCENTILE_95",
|
||||
11: "REDUCE_PERCENTILE_50",
|
||||
12: "REDUCE_PERCENTILE_05",
|
||||
}
|
||||
var Aggregation_Reducer_value = map[string]int32{
|
||||
"REDUCE_NONE": 0,
|
||||
"REDUCE_MEAN": 1,
|
||||
"REDUCE_MIN": 2,
|
||||
"REDUCE_MAX": 3,
|
||||
"REDUCE_SUM": 4,
|
||||
"REDUCE_STDDEV": 5,
|
||||
"REDUCE_COUNT": 6,
|
||||
"REDUCE_COUNT_TRUE": 7,
|
||||
"REDUCE_COUNT_FALSE": 15,
|
||||
"REDUCE_FRACTION_TRUE": 8,
|
||||
"REDUCE_PERCENTILE_99": 9,
|
||||
"REDUCE_PERCENTILE_95": 10,
|
||||
"REDUCE_PERCENTILE_50": 11,
|
||||
"REDUCE_PERCENTILE_05": 12,
|
||||
}
|
||||
|
||||
func (x Aggregation_Reducer) String() string {
|
||||
return proto.EnumName(Aggregation_Reducer_name, int32(x))
|
||||
}
|
||||
func (Aggregation_Reducer) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_common_bd839df590cb6820, []int{2, 1}
|
||||
}
|
||||
|
||||
// A single strongly-typed value.
|
||||
type TypedValue struct {
|
||||
// The typed value field.
|
||||
//
|
||||
// Types that are valid to be assigned to Value:
|
||||
// *TypedValue_BoolValue
|
||||
// *TypedValue_Int64Value
|
||||
// *TypedValue_DoubleValue
|
||||
// *TypedValue_StringValue
|
||||
// *TypedValue_DistributionValue
|
||||
Value isTypedValue_Value `protobuf_oneof:"value"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *TypedValue) Reset() { *m = TypedValue{} }
|
||||
func (m *TypedValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*TypedValue) ProtoMessage() {}
|
||||
func (*TypedValue) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_common_bd839df590cb6820, []int{0}
|
||||
}
|
||||
func (m *TypedValue) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_TypedValue.Unmarshal(m, b)
|
||||
}
|
||||
func (m *TypedValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_TypedValue.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *TypedValue) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_TypedValue.Merge(dst, src)
|
||||
}
|
||||
func (m *TypedValue) XXX_Size() int {
|
||||
return xxx_messageInfo_TypedValue.Size(m)
|
||||
}
|
||||
func (m *TypedValue) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_TypedValue.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_TypedValue proto.InternalMessageInfo
|
||||
|
||||
type isTypedValue_Value interface {
|
||||
isTypedValue_Value()
|
||||
}
|
||||
|
||||
type TypedValue_BoolValue struct {
|
||||
BoolValue bool `protobuf:"varint,1,opt,name=bool_value,json=boolValue,proto3,oneof"`
|
||||
}
|
||||
|
||||
type TypedValue_Int64Value struct {
|
||||
Int64Value int64 `protobuf:"varint,2,opt,name=int64_value,json=int64Value,proto3,oneof"`
|
||||
}
|
||||
|
||||
type TypedValue_DoubleValue struct {
|
||||
DoubleValue float64 `protobuf:"fixed64,3,opt,name=double_value,json=doubleValue,proto3,oneof"`
|
||||
}
|
||||
|
||||
type TypedValue_StringValue struct {
|
||||
StringValue string `protobuf:"bytes,4,opt,name=string_value,json=stringValue,proto3,oneof"`
|
||||
}
|
||||
|
||||
type TypedValue_DistributionValue struct {
|
||||
DistributionValue *distribution.Distribution `protobuf:"bytes,5,opt,name=distribution_value,json=distributionValue,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*TypedValue_BoolValue) isTypedValue_Value() {}
|
||||
|
||||
func (*TypedValue_Int64Value) isTypedValue_Value() {}
|
||||
|
||||
func (*TypedValue_DoubleValue) isTypedValue_Value() {}
|
||||
|
||||
func (*TypedValue_StringValue) isTypedValue_Value() {}
|
||||
|
||||
func (*TypedValue_DistributionValue) isTypedValue_Value() {}
|
||||
|
||||
func (m *TypedValue) GetValue() isTypedValue_Value {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TypedValue) GetBoolValue() bool {
|
||||
if x, ok := m.GetValue().(*TypedValue_BoolValue); ok {
|
||||
return x.BoolValue
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *TypedValue) GetInt64Value() int64 {
|
||||
if x, ok := m.GetValue().(*TypedValue_Int64Value); ok {
|
||||
return x.Int64Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *TypedValue) GetDoubleValue() float64 {
|
||||
if x, ok := m.GetValue().(*TypedValue_DoubleValue); ok {
|
||||
return x.DoubleValue
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *TypedValue) GetStringValue() string {
|
||||
if x, ok := m.GetValue().(*TypedValue_StringValue); ok {
|
||||
return x.StringValue
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *TypedValue) GetDistributionValue() *distribution.Distribution {
|
||||
if x, ok := m.GetValue().(*TypedValue_DistributionValue); ok {
|
||||
return x.DistributionValue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*TypedValue) 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 _TypedValue_OneofMarshaler, _TypedValue_OneofUnmarshaler, _TypedValue_OneofSizer, []interface{}{
|
||||
(*TypedValue_BoolValue)(nil),
|
||||
(*TypedValue_Int64Value)(nil),
|
||||
(*TypedValue_DoubleValue)(nil),
|
||||
(*TypedValue_StringValue)(nil),
|
||||
(*TypedValue_DistributionValue)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _TypedValue_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*TypedValue)
|
||||
// value
|
||||
switch x := m.Value.(type) {
|
||||
case *TypedValue_BoolValue:
|
||||
t := uint64(0)
|
||||
if x.BoolValue {
|
||||
t = 1
|
||||
}
|
||||
b.EncodeVarint(1<<3 | proto.WireVarint)
|
||||
b.EncodeVarint(t)
|
||||
case *TypedValue_Int64Value:
|
||||
b.EncodeVarint(2<<3 | proto.WireVarint)
|
||||
b.EncodeVarint(uint64(x.Int64Value))
|
||||
case *TypedValue_DoubleValue:
|
||||
b.EncodeVarint(3<<3 | proto.WireFixed64)
|
||||
b.EncodeFixed64(math.Float64bits(x.DoubleValue))
|
||||
case *TypedValue_StringValue:
|
||||
b.EncodeVarint(4<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.StringValue)
|
||||
case *TypedValue_DistributionValue:
|
||||
b.EncodeVarint(5<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.DistributionValue); err != nil {
|
||||
return err
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("TypedValue.Value has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _TypedValue_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*TypedValue)
|
||||
switch tag {
|
||||
case 1: // value.bool_value
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeVarint()
|
||||
m.Value = &TypedValue_BoolValue{x != 0}
|
||||
return true, err
|
||||
case 2: // value.int64_value
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeVarint()
|
||||
m.Value = &TypedValue_Int64Value{int64(x)}
|
||||
return true, err
|
||||
case 3: // value.double_value
|
||||
if wire != proto.WireFixed64 {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeFixed64()
|
||||
m.Value = &TypedValue_DoubleValue{math.Float64frombits(x)}
|
||||
return true, err
|
||||
case 4: // value.string_value
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.Value = &TypedValue_StringValue{x}
|
||||
return true, err
|
||||
case 5: // value.distribution_value
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(distribution.Distribution)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Value = &TypedValue_DistributionValue{msg}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _TypedValue_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*TypedValue)
|
||||
// value
|
||||
switch x := m.Value.(type) {
|
||||
case *TypedValue_BoolValue:
|
||||
n += 1 // tag and wire
|
||||
n += 1
|
||||
case *TypedValue_Int64Value:
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(x.Int64Value))
|
||||
case *TypedValue_DoubleValue:
|
||||
n += 1 // tag and wire
|
||||
n += 8
|
||||
case *TypedValue_StringValue:
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(len(x.StringValue)))
|
||||
n += len(x.StringValue)
|
||||
case *TypedValue_DistributionValue:
|
||||
s := proto.Size(x.DistributionValue)
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// A time interval extending just after a start time through an end time.
|
||||
// If the start time is the same as the end time, then the interval
|
||||
// represents a single point in time.
|
||||
type TimeInterval struct {
|
||||
// Required. The end of the time interval.
|
||||
EndTime *timestamp.Timestamp `protobuf:"bytes,2,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
|
||||
// Optional. The beginning of the time interval. The default value
|
||||
// for the start time is the end time. The start time must not be
|
||||
// later than the end time.
|
||||
StartTime *timestamp.Timestamp `protobuf:"bytes,1,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *TimeInterval) Reset() { *m = TimeInterval{} }
|
||||
func (m *TimeInterval) String() string { return proto.CompactTextString(m) }
|
||||
func (*TimeInterval) ProtoMessage() {}
|
||||
func (*TimeInterval) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_common_bd839df590cb6820, []int{1}
|
||||
}
|
||||
func (m *TimeInterval) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_TimeInterval.Unmarshal(m, b)
|
||||
}
|
||||
func (m *TimeInterval) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_TimeInterval.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *TimeInterval) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_TimeInterval.Merge(dst, src)
|
||||
}
|
||||
func (m *TimeInterval) XXX_Size() int {
|
||||
return xxx_messageInfo_TimeInterval.Size(m)
|
||||
}
|
||||
func (m *TimeInterval) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_TimeInterval.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_TimeInterval proto.InternalMessageInfo
|
||||
|
||||
func (m *TimeInterval) GetEndTime() *timestamp.Timestamp {
|
||||
if m != nil {
|
||||
return m.EndTime
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TimeInterval) GetStartTime() *timestamp.Timestamp {
|
||||
if m != nil {
|
||||
return m.StartTime
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Describes how to combine multiple time series to provide different views of
|
||||
// the data. Aggregation consists of an alignment step on individual time
|
||||
// series (`alignment_period` and `per_series_aligner`) followed by an optional
|
||||
// reduction step of the data across the aligned time series
|
||||
// (`cross_series_reducer` and `group_by_fields`). For more details, see
|
||||
// [Aggregation](/monitoring/api/learn_more#aggregation).
|
||||
type Aggregation struct {
|
||||
// The alignment period for per-[time series][google.monitoring.v3.TimeSeries]
|
||||
// alignment. If present, `alignmentPeriod` must be at least 60
|
||||
// seconds. After per-time series alignment, each time series will
|
||||
// contain data points only on the period boundaries. If
|
||||
// `perSeriesAligner` is not specified or equals `ALIGN_NONE`, then
|
||||
// this field is ignored. If `perSeriesAligner` is specified and
|
||||
// does not equal `ALIGN_NONE`, then this field must be defined;
|
||||
// otherwise an error is returned.
|
||||
AlignmentPeriod *duration.Duration `protobuf:"bytes,1,opt,name=alignment_period,json=alignmentPeriod,proto3" json:"alignment_period,omitempty"`
|
||||
// The approach to be used to align individual time series. Not all
|
||||
// alignment functions may be applied to all time series, depending
|
||||
// on the metric type and value type of the original time
|
||||
// series. Alignment may change the metric type or the value type of
|
||||
// the time series.
|
||||
//
|
||||
// Time series data must be aligned in order to perform cross-time
|
||||
// series reduction. If `crossSeriesReducer` is specified, then
|
||||
// `perSeriesAligner` must be specified and not equal `ALIGN_NONE`
|
||||
// and `alignmentPeriod` must be specified; otherwise, an error is
|
||||
// returned.
|
||||
PerSeriesAligner Aggregation_Aligner `protobuf:"varint,2,opt,name=per_series_aligner,json=perSeriesAligner,proto3,enum=google.monitoring.v3.Aggregation_Aligner" json:"per_series_aligner,omitempty"`
|
||||
// The approach to be used to combine time series. Not all reducer
|
||||
// functions may be applied to all time series, depending on the
|
||||
// metric type and the value type of the original time
|
||||
// series. Reduction may change the metric type of value type of the
|
||||
// time series.
|
||||
//
|
||||
// Time series data must be aligned in order to perform cross-time
|
||||
// series reduction. If `crossSeriesReducer` is specified, then
|
||||
// `perSeriesAligner` must be specified and not equal `ALIGN_NONE`
|
||||
// and `alignmentPeriod` must be specified; otherwise, an error is
|
||||
// returned.
|
||||
CrossSeriesReducer Aggregation_Reducer `protobuf:"varint,4,opt,name=cross_series_reducer,json=crossSeriesReducer,proto3,enum=google.monitoring.v3.Aggregation_Reducer" json:"cross_series_reducer,omitempty"`
|
||||
// The set of fields to preserve when `crossSeriesReducer` is
|
||||
// specified. The `groupByFields` determine how the time series are
|
||||
// partitioned into subsets prior to applying the aggregation
|
||||
// function. Each subset contains time series that have the same
|
||||
// value for each of the grouping fields. Each individual time
|
||||
// series is a member of exactly one subset. The
|
||||
// `crossSeriesReducer` is applied to each subset of time series.
|
||||
// It is not possible to reduce across different resource types, so
|
||||
// this field implicitly contains `resource.type`. Fields not
|
||||
// specified in `groupByFields` are aggregated away. If
|
||||
// `groupByFields` is not specified and all the time series have
|
||||
// the same resource type, then the time series are aggregated into
|
||||
// a single output time series. If `crossSeriesReducer` is not
|
||||
// defined, this field is ignored.
|
||||
GroupByFields []string `protobuf:"bytes,5,rep,name=group_by_fields,json=groupByFields,proto3" json:"group_by_fields,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Aggregation) Reset() { *m = Aggregation{} }
|
||||
func (m *Aggregation) String() string { return proto.CompactTextString(m) }
|
||||
func (*Aggregation) ProtoMessage() {}
|
||||
func (*Aggregation) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_common_bd839df590cb6820, []int{2}
|
||||
}
|
||||
func (m *Aggregation) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Aggregation.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Aggregation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Aggregation.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Aggregation) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Aggregation.Merge(dst, src)
|
||||
}
|
||||
func (m *Aggregation) XXX_Size() int {
|
||||
return xxx_messageInfo_Aggregation.Size(m)
|
||||
}
|
||||
func (m *Aggregation) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Aggregation.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Aggregation proto.InternalMessageInfo
|
||||
|
||||
func (m *Aggregation) GetAlignmentPeriod() *duration.Duration {
|
||||
if m != nil {
|
||||
return m.AlignmentPeriod
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Aggregation) GetPerSeriesAligner() Aggregation_Aligner {
|
||||
if m != nil {
|
||||
return m.PerSeriesAligner
|
||||
}
|
||||
return Aggregation_ALIGN_NONE
|
||||
}
|
||||
|
||||
func (m *Aggregation) GetCrossSeriesReducer() Aggregation_Reducer {
|
||||
if m != nil {
|
||||
return m.CrossSeriesReducer
|
||||
}
|
||||
return Aggregation_REDUCE_NONE
|
||||
}
|
||||
|
||||
func (m *Aggregation) GetGroupByFields() []string {
|
||||
if m != nil {
|
||||
return m.GroupByFields
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*TypedValue)(nil), "google.monitoring.v3.TypedValue")
|
||||
proto.RegisterType((*TimeInterval)(nil), "google.monitoring.v3.TimeInterval")
|
||||
proto.RegisterType((*Aggregation)(nil), "google.monitoring.v3.Aggregation")
|
||||
proto.RegisterEnum("google.monitoring.v3.ComparisonType", ComparisonType_name, ComparisonType_value)
|
||||
proto.RegisterEnum("google.monitoring.v3.ServiceTier", ServiceTier_name, ServiceTier_value)
|
||||
proto.RegisterEnum("google.monitoring.v3.Aggregation_Aligner", Aggregation_Aligner_name, Aggregation_Aligner_value)
|
||||
proto.RegisterEnum("google.monitoring.v3.Aggregation_Reducer", Aggregation_Reducer_name, Aggregation_Reducer_value)
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google/monitoring/v3/common.proto", fileDescriptor_common_bd839df590cb6820)
|
||||
}
|
||||
|
||||
var fileDescriptor_common_bd839df590cb6820 = []byte{
|
||||
// 957 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x95, 0xc1, 0x6e, 0xe3, 0x44,
|
||||
0x18, 0xc7, 0xe3, 0x64, 0xdb, 0x34, 0x9f, 0xdb, 0x66, 0x3a, 0xdb, 0xed, 0x86, 0x68, 0x61, 0xb3,
|
||||
0x45, 0x42, 0x61, 0x0f, 0x4e, 0xd5, 0x12, 0xa4, 0x0a, 0x09, 0xc9, 0x75, 0xa6, 0xad, 0xa5, 0xc4,
|
||||
0x09, 0x13, 0xa7, 0x54, 0x50, 0xc9, 0x72, 0x9a, 0x59, 0xcb, 0x52, 0xe2, 0xb1, 0x6c, 0xa7, 0x52,
|
||||
0x6f, 0xdc, 0x79, 0x07, 0x2e, 0xdc, 0xb8, 0xf1, 0x1a, 0x3c, 0x0c, 0x17, 0x5e, 0x00, 0x79, 0xc6,
|
||||
0x59, 0x3b, 0x21, 0x08, 0x8e, 0xdf, 0xef, 0xff, 0xff, 0xbe, 0x99, 0xf9, 0x8f, 0x35, 0x86, 0x77,
|
||||
0x1e, 0xe7, 0xde, 0x9c, 0x75, 0x16, 0x3c, 0xf0, 0x13, 0x1e, 0xf9, 0x81, 0xd7, 0x79, 0xba, 0xe8,
|
||||
0x3c, 0xf2, 0xc5, 0x82, 0x07, 0x5a, 0x18, 0xf1, 0x84, 0xe3, 0x63, 0x69, 0xd1, 0x72, 0x8b, 0xf6,
|
||||
0x74, 0xd1, 0x7c, 0x93, 0x35, 0xba, 0xa1, 0xdf, 0x71, 0x83, 0x80, 0x27, 0x6e, 0xe2, 0xf3, 0x20,
|
||||
0x96, 0x3d, 0xcd, 0x4f, 0x0b, 0xea, 0xcc, 0x8f, 0x93, 0xc8, 0x9f, 0x2e, 0x53, 0x3d, 0x93, 0x3f,
|
||||
0xcb, 0x64, 0x51, 0x4d, 0x97, 0x1f, 0x3a, 0xb3, 0x65, 0xe4, 0x16, 0xf4, 0xb7, 0x9b, 0x7a, 0xe2,
|
||||
0x2f, 0x58, 0x9c, 0xb8, 0x8b, 0x50, 0x1a, 0x4e, 0xff, 0x54, 0x00, 0xec, 0xe7, 0x90, 0xcd, 0xee,
|
||||
0xdc, 0xf9, 0x92, 0xe1, 0xb7, 0x00, 0x53, 0xce, 0xe7, 0xce, 0x53, 0x5a, 0x35, 0x94, 0x96, 0xd2,
|
||||
0xde, 0xbb, 0x2d, 0xd1, 0x5a, 0xca, 0xa4, 0xe1, 0x1d, 0xa8, 0x7e, 0x90, 0x7c, 0xfd, 0x55, 0xe6,
|
||||
0x28, 0xb7, 0x94, 0x76, 0xe5, 0xb6, 0x44, 0x41, 0x40, 0x69, 0xf9, 0x1c, 0xf6, 0x67, 0x7c, 0x39,
|
||||
0x9d, 0xb3, 0xcc, 0x53, 0x69, 0x29, 0x6d, 0xe5, 0xb6, 0x44, 0x55, 0x49, 0x3f, 0x9a, 0xd2, 0xc3,
|
||||
0x04, 0x5e, 0x66, 0x7a, 0xd1, 0x52, 0xda, 0xb5, 0xd4, 0x24, 0xa9, 0x34, 0x99, 0x80, 0x8b, 0x67,
|
||||
0xce, 0xac, 0x3b, 0x2d, 0xa5, 0xad, 0x9e, 0x37, 0xb4, 0x2c, 0x4d, 0x37, 0xf4, 0xb5, 0x5e, 0xc1,
|
||||
0x75, 0x5b, 0xa2, 0x47, 0xc5, 0x2e, 0x31, 0xea, 0xaa, 0x0a, 0x3b, 0xa2, 0xfb, 0xf4, 0x27, 0x05,
|
||||
0xf6, 0x6d, 0x7f, 0xc1, 0xcc, 0x20, 0x61, 0xd1, 0x93, 0x3b, 0xc7, 0x5d, 0xd8, 0x63, 0xc1, 0xcc,
|
||||
0x49, 0x83, 0x11, 0xc7, 0x51, 0xcf, 0x9b, 0xab, 0xd1, 0xab, 0xd4, 0x34, 0x7b, 0x95, 0x1a, 0xad,
|
||||
0xb2, 0x60, 0x96, 0x56, 0xf8, 0x12, 0x20, 0x4e, 0xdc, 0x28, 0x91, 0x8d, 0xca, 0x7f, 0x36, 0xd6,
|
||||
0x84, 0x3b, 0xad, 0x4f, 0xff, 0xaa, 0x82, 0xaa, 0x7b, 0x5e, 0xc4, 0x3c, 0x71, 0x55, 0xb8, 0x07,
|
||||
0xc8, 0x9d, 0xfb, 0x5e, 0xb0, 0x60, 0x41, 0xe2, 0x84, 0x2c, 0xf2, 0xf9, 0x2c, 0x1b, 0xf8, 0xc9,
|
||||
0x3f, 0x06, 0xf6, 0xb2, 0xfb, 0xa5, 0xf5, 0x8f, 0x2d, 0x23, 0xd1, 0x81, 0xbf, 0x07, 0x1c, 0xb2,
|
||||
0xc8, 0x89, 0x59, 0xe4, 0xb3, 0xd8, 0x11, 0x2a, 0x8b, 0xc4, 0x89, 0x0e, 0xcf, 0xbf, 0xd4, 0xb6,
|
||||
0x7d, 0x7a, 0x5a, 0x61, 0x13, 0x9a, 0x2e, 0x1b, 0x28, 0x0a, 0x59, 0x34, 0x16, 0x33, 0x32, 0x82,
|
||||
0x7f, 0x84, 0xe3, 0xc7, 0x88, 0xc7, 0xf1, 0x6a, 0x74, 0xc4, 0x66, 0xcb, 0x47, 0x16, 0x89, 0x2b,
|
||||
0xfb, 0x5f, 0xa3, 0xa9, 0x6c, 0xa0, 0x58, 0x8c, 0x91, 0xc3, 0x33, 0x86, 0xbf, 0x80, 0xba, 0x17,
|
||||
0xf1, 0x65, 0xe8, 0x4c, 0x9f, 0x9d, 0x0f, 0x3e, 0x9b, 0xcf, 0xe2, 0xc6, 0x4e, 0xab, 0xd2, 0xae,
|
||||
0xd1, 0x03, 0x81, 0xaf, 0x9e, 0xaf, 0x05, 0x3c, 0xfd, 0xb9, 0x02, 0xd5, 0xd5, 0x86, 0x0e, 0x01,
|
||||
0xf4, 0xbe, 0x79, 0x63, 0x39, 0xd6, 0xd0, 0x22, 0xa8, 0x84, 0xeb, 0xa0, 0xca, 0xba, 0x47, 0xfa,
|
||||
0xb6, 0x8e, 0x94, 0xdc, 0x40, 0x75, 0x9b, 0xa0, 0x32, 0x7e, 0x05, 0x47, 0xb2, 0x36, 0x2d, 0x9b,
|
||||
0xd0, 0xd1, 0xb0, 0x9f, 0xe2, 0x0a, 0x3e, 0x06, 0x94, 0xcd, 0x21, 0xf7, 0xb6, 0x33, 0xec, 0xf7,
|
||||
0x08, 0x45, 0x2f, 0xf0, 0x01, 0xd4, 0x24, 0x1d, 0x98, 0x16, 0x82, 0x42, 0xa9, 0xdf, 0x23, 0x35,
|
||||
0x1f, 0x3d, 0x20, 0xba, 0x85, 0xf6, 0xf3, 0xb5, 0x8d, 0xe1, 0xc4, 0xb2, 0xd1, 0x41, 0xee, 0x1f,
|
||||
0x4f, 0x06, 0xe8, 0x10, 0x23, 0xd8, 0xcf, 0x4a, 0xbb, 0xd7, 0x23, 0x77, 0xa8, 0x9e, 0xaf, 0x2a,
|
||||
0x3a, 0x1c, 0x9b, 0x4e, 0x08, 0x42, 0xf9, 0x16, 0x25, 0xbd, 0xd6, 0xfb, 0x63, 0x82, 0x1a, 0xf8,
|
||||
0x35, 0xbc, 0x94, 0xf8, 0x9a, 0xea, 0x86, 0x6d, 0x0e, 0x2d, 0xe9, 0x3f, 0xca, 0x85, 0x11, 0xa1,
|
||||
0x06, 0xb1, 0x6c, 0xb3, 0x4f, 0x9c, 0xcb, 0x4b, 0x84, 0xb7, 0x0b, 0x5d, 0xf4, 0x72, 0xab, 0xd0,
|
||||
0x3d, 0x43, 0xc7, 0x5b, 0x85, 0xb3, 0x2e, 0x7a, 0x85, 0x1b, 0x70, 0xbc, 0x26, 0x38, 0xc6, 0xad,
|
||||
0x6e, 0xdd, 0x10, 0xf4, 0xfa, 0xf4, 0xf7, 0x32, 0x54, 0x57, 0x37, 0x58, 0x07, 0x95, 0x92, 0xde,
|
||||
0xc4, 0x20, 0x85, 0xeb, 0xc8, 0x80, 0xc8, 0x48, 0x5c, 0xc7, 0x0a, 0x98, 0x16, 0x2a, 0x17, 0x6b,
|
||||
0xfd, 0x1e, 0x55, 0x0a, 0x75, 0x9a, 0xd9, 0x0b, 0x7c, 0x04, 0x07, 0xab, 0x5a, 0x86, 0xb6, 0x93,
|
||||
0xc6, 0x98, 0x21, 0x99, 0xf3, 0x6e, 0x1a, 0x58, 0x91, 0xc8, 0x5c, 0xaa, 0xf8, 0x04, 0xf0, 0x1a,
|
||||
0x96, 0x41, 0xd6, 0xd3, 0xb3, 0x64, 0x7c, 0x3d, 0xc9, 0xbd, 0x82, 0xb2, 0x1e, 0x65, 0xed, 0x5f,
|
||||
0x94, 0x2e, 0x82, 0xed, 0x4a, 0xf7, 0x0c, 0xa9, 0xdb, 0x95, 0xb3, 0x2e, 0xda, 0x7f, 0xff, 0x8b,
|
||||
0x02, 0x87, 0x06, 0x5f, 0x84, 0x6e, 0xe4, 0xc7, 0x3c, 0x48, 0xdf, 0x5c, 0xdc, 0x84, 0x13, 0x63,
|
||||
0x38, 0x18, 0xe9, 0xd4, 0x1c, 0x0f, 0x2d, 0x67, 0x62, 0x8d, 0x47, 0xc4, 0x30, 0xaf, 0x4d, 0xd2,
|
||||
0x43, 0xa5, 0x34, 0x84, 0x82, 0x76, 0x63, 0x23, 0x65, 0x13, 0xa5, 0x5f, 0xf6, 0x3a, 0xea, 0xdb,
|
||||
0xa8, 0xb2, 0x89, 0x88, 0x0c, 0xb4, 0x80, 0xc8, 0x77, 0x68, 0x67, 0x03, 0x59, 0x04, 0xed, 0xbe,
|
||||
0x77, 0x41, 0x1d, 0xb3, 0xe8, 0xc9, 0x7f, 0x64, 0xb6, 0xcf, 0x22, 0xfc, 0x06, 0x1a, 0x63, 0x42,
|
||||
0xef, 0x4c, 0x83, 0x38, 0xb6, 0x49, 0xe8, 0xc6, 0xf6, 0x4e, 0x00, 0xaf, 0xa9, 0x57, 0xfa, 0xd8,
|
||||
0x34, 0x90, 0x92, 0x9e, 0x7f, 0x8d, 0x8f, 0x28, 0x19, 0x98, 0x93, 0x01, 0x2a, 0x37, 0xcb, 0x0d,
|
||||
0xe5, 0xea, 0x57, 0x05, 0x1a, 0x8f, 0x7c, 0xb1, 0xf5, 0xc9, 0xb8, 0x52, 0x0d, 0xf1, 0xb3, 0x1c,
|
||||
0xa5, 0x4f, 0xdd, 0x48, 0xf9, 0xe1, 0xdb, 0xcc, 0xe4, 0xf1, 0xb9, 0x1b, 0x78, 0x1a, 0x8f, 0xbc,
|
||||
0x8e, 0xc7, 0x02, 0xf1, 0x10, 0x76, 0xa4, 0xe4, 0x86, 0x7e, 0xbc, 0xfe, 0xbf, 0xfd, 0x26, 0xaf,
|
||||
0x7e, 0x2b, 0x37, 0x6f, 0xe4, 0x00, 0x63, 0xce, 0x97, 0x33, 0x6d, 0x90, 0xaf, 0x75, 0x77, 0xf1,
|
||||
0xc7, 0x4a, 0x7c, 0x10, 0xe2, 0x43, 0x2e, 0x3e, 0xdc, 0x5d, 0x4c, 0x77, 0xc5, 0x22, 0x17, 0x7f,
|
||||
0x07, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x78, 0xd9, 0x96, 0xd3, 0x07, 0x00, 0x00,
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/monitoring/v3/dropped_labels.proto
|
||||
|
||||
package monitoring // import "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
|
||||
// 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 set of (label, value) pairs which were dropped during aggregation, attached
|
||||
// to google.api.Distribution.Exemplars in google.api.Distribution values during
|
||||
// aggregation.
|
||||
//
|
||||
// These values are used in combination with the label values that remain on the
|
||||
// aggregated Distribution timeseries to construct the full label set for the
|
||||
// exemplar values. The resulting full label set may be used to identify the
|
||||
// specific task/job/instance (for example) which may be contributing to a
|
||||
// long-tail, while allowing the storage savings of only storing aggregated
|
||||
// distribution values for a large group.
|
||||
//
|
||||
// Note that there are no guarantees on ordering of the labels from
|
||||
// exemplar-to-exemplar and from distribution-to-distribution in the same
|
||||
// stream, and there may be duplicates. It is up to clients to resolve any
|
||||
// ambiguities.
|
||||
type DroppedLabels struct {
|
||||
// Map from label to its value, for all labels dropped in any aggregation.
|
||||
Label map[string]string `protobuf:"bytes,1,rep,name=label,proto3" json:"label,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *DroppedLabels) Reset() { *m = DroppedLabels{} }
|
||||
func (m *DroppedLabels) String() string { return proto.CompactTextString(m) }
|
||||
func (*DroppedLabels) ProtoMessage() {}
|
||||
func (*DroppedLabels) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_dropped_labels_22899c9e024c97fa, []int{0}
|
||||
}
|
||||
func (m *DroppedLabels) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_DroppedLabels.Unmarshal(m, b)
|
||||
}
|
||||
func (m *DroppedLabels) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_DroppedLabels.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *DroppedLabels) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_DroppedLabels.Merge(dst, src)
|
||||
}
|
||||
func (m *DroppedLabels) XXX_Size() int {
|
||||
return xxx_messageInfo_DroppedLabels.Size(m)
|
||||
}
|
||||
func (m *DroppedLabels) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_DroppedLabels.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_DroppedLabels proto.InternalMessageInfo
|
||||
|
||||
func (m *DroppedLabels) GetLabel() map[string]string {
|
||||
if m != nil {
|
||||
return m.Label
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*DroppedLabels)(nil), "google.monitoring.v3.DroppedLabels")
|
||||
proto.RegisterMapType((map[string]string)(nil), "google.monitoring.v3.DroppedLabels.LabelEntry")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google/monitoring/v3/dropped_labels.proto", fileDescriptor_dropped_labels_22899c9e024c97fa)
|
||||
}
|
||||
|
||||
var fileDescriptor_dropped_labels_22899c9e024c97fa = []byte{
|
||||
// 219 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4c, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0xcf, 0xcd, 0xcf, 0xcb, 0x2c, 0xc9, 0x2f, 0xca, 0xcc, 0x4b, 0xd7, 0x2f, 0x33,
|
||||
0xd6, 0x4f, 0x29, 0xca, 0x2f, 0x28, 0x48, 0x4d, 0x89, 0xcf, 0x49, 0x4c, 0x4a, 0xcd, 0x29, 0xd6,
|
||||
0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x81, 0x28, 0xd5, 0x43, 0x28, 0xd5, 0x2b, 0x33, 0x96,
|
||||
0x92, 0x81, 0x1a, 0x90, 0x58, 0x90, 0xa9, 0x9f, 0x98, 0x97, 0x97, 0x5f, 0x92, 0x58, 0x92, 0x99,
|
||||
0x9f, 0x07, 0xd5, 0xa3, 0xd4, 0xcf, 0xc8, 0xc5, 0xeb, 0x02, 0x31, 0xcc, 0x07, 0x6c, 0x96, 0x90,
|
||||
0x0b, 0x17, 0x2b, 0xd8, 0x54, 0x09, 0x46, 0x05, 0x66, 0x0d, 0x6e, 0x23, 0x3d, 0x3d, 0x6c, 0xa6,
|
||||
0xea, 0xa1, 0xe8, 0xd1, 0x03, 0x53, 0xae, 0x79, 0x25, 0x45, 0x95, 0x41, 0x10, 0xcd, 0x52, 0x16,
|
||||
0x5c, 0x5c, 0x08, 0x41, 0x21, 0x01, 0x2e, 0xe6, 0xec, 0xd4, 0x4a, 0x09, 0x46, 0x05, 0x46, 0x0d,
|
||||
0xce, 0x20, 0x10, 0x53, 0x48, 0x84, 0x8b, 0xb5, 0x2c, 0x31, 0xa7, 0x34, 0x55, 0x82, 0x09, 0x2c,
|
||||
0x06, 0xe1, 0x58, 0x31, 0x59, 0x30, 0x3a, 0x39, 0x44, 0xd9, 0x41, 0x6d, 0x4c, 0xcf, 0xcf, 0x49,
|
||||
0xcc, 0x4b, 0xd7, 0xcb, 0x2f, 0x4a, 0xd7, 0x4f, 0x4f, 0xcd, 0x03, 0xbb, 0x57, 0x1f, 0x22, 0x95,
|
||||
0x58, 0x90, 0x59, 0x8c, 0x1a, 0x22, 0xd6, 0x08, 0x5e, 0x12, 0x1b, 0x58, 0xa9, 0x31, 0x20, 0x00,
|
||||
0x00, 0xff, 0xff, 0x7e, 0x29, 0xf8, 0x00, 0x3b, 0x01, 0x00, 0x00,
|
||||
}
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/monitoring/v3/group.proto
|
||||
|
||||
package monitoring // import "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
|
||||
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
|
||||
|
||||
// The description of a dynamic collection of monitored resources. Each group
|
||||
// has a filter that is matched against monitored resources and their associated
|
||||
// metadata. If a group's filter matches an available monitored resource, then
|
||||
// that resource is a member of that group. Groups can contain any number of
|
||||
// monitored resources, and each monitored resource can be a member of any
|
||||
// number of groups.
|
||||
//
|
||||
// Groups can be nested in parent-child hierarchies. The `parentName` field
|
||||
// identifies an optional parent for each group. If a group has a parent, then
|
||||
// the only monitored resources available to be matched by the group's filter
|
||||
// are the resources contained in the parent group. In other words, a group
|
||||
// contains the monitored resources that match its filter and the filters of all
|
||||
// the group's ancestors. A group without a parent can contain any monitored
|
||||
// resource.
|
||||
//
|
||||
// For example, consider an infrastructure running a set of instances with two
|
||||
// user-defined tags: `"environment"` and `"role"`. A parent group has a filter,
|
||||
// `environment="production"`. A child of that parent group has a filter,
|
||||
// `role="transcoder"`. The parent group contains all instances in the
|
||||
// production environment, regardless of their roles. The child group contains
|
||||
// instances that have the transcoder role *and* are in the production
|
||||
// environment.
|
||||
//
|
||||
// The monitored resources contained in a group can change at any moment,
|
||||
// depending on what resources exist and what filters are associated with the
|
||||
// group and its ancestors.
|
||||
type Group struct {
|
||||
// Output only. The name of this group. The format is
|
||||
// `"projects/{project_id_or_number}/groups/{group_id}"`.
|
||||
// When creating a group, this field is ignored and a new name is created
|
||||
// consisting of the project specified in the call to `CreateGroup`
|
||||
// and a unique `{group_id}` that is generated automatically.
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// A user-assigned name for this group, used only for display purposes.
|
||||
DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
|
||||
// The name of the group's parent, if it has one.
|
||||
// The format is `"projects/{project_id_or_number}/groups/{group_id}"`.
|
||||
// For groups with no parent, `parentName` is the empty string, `""`.
|
||||
ParentName string `protobuf:"bytes,3,opt,name=parent_name,json=parentName,proto3" json:"parent_name,omitempty"`
|
||||
// The filter used to determine which monitored resources belong to this group.
|
||||
Filter string `protobuf:"bytes,5,opt,name=filter,proto3" json:"filter,omitempty"`
|
||||
// If true, the members of this group are considered to be a cluster.
|
||||
// The system can perform additional analysis on groups that are clusters.
|
||||
IsCluster bool `protobuf:"varint,6,opt,name=is_cluster,json=isCluster,proto3" json:"is_cluster,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Group) Reset() { *m = Group{} }
|
||||
func (m *Group) String() string { return proto.CompactTextString(m) }
|
||||
func (*Group) ProtoMessage() {}
|
||||
func (*Group) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_group_ddaab360fd5d459d, []int{0}
|
||||
}
|
||||
func (m *Group) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Group.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Group.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Group) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Group.Merge(dst, src)
|
||||
}
|
||||
func (m *Group) XXX_Size() int {
|
||||
return xxx_messageInfo_Group.Size(m)
|
||||
}
|
||||
func (m *Group) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Group.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Group proto.InternalMessageInfo
|
||||
|
||||
func (m *Group) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Group) GetDisplayName() string {
|
||||
if m != nil {
|
||||
return m.DisplayName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Group) GetParentName() string {
|
||||
if m != nil {
|
||||
return m.ParentName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Group) GetFilter() string {
|
||||
if m != nil {
|
||||
return m.Filter
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Group) GetIsCluster() bool {
|
||||
if m != nil {
|
||||
return m.IsCluster
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Group)(nil), "google.monitoring.v3.Group")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google/monitoring/v3/group.proto", fileDescriptor_group_ddaab360fd5d459d)
|
||||
}
|
||||
|
||||
var fileDescriptor_group_ddaab360fd5d459d = []byte{
|
||||
// 261 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xcf, 0x4a, 0x2b, 0x31,
|
||||
0x14, 0x87, 0x49, 0xef, 0xed, 0x60, 0x4f, 0x5d, 0x0d, 0x22, 0x83, 0x20, 0x8e, 0xae, 0xba, 0xca,
|
||||
0x2c, 0xb2, 0x14, 0x5c, 0xb4, 0x8b, 0xae, 0x94, 0xd2, 0x45, 0x17, 0x32, 0x50, 0x62, 0x1b, 0x43,
|
||||
0x20, 0x93, 0x13, 0x92, 0x99, 0x82, 0x2f, 0xe2, 0x03, 0xb8, 0xf4, 0x51, 0x7c, 0x2a, 0x99, 0x93,
|
||||
0x91, 0x41, 0x70, 0x97, 0xf3, 0xfb, 0x3e, 0x72, 0xfe, 0x40, 0xa9, 0x11, 0xb5, 0x55, 0x55, 0x83,
|
||||
0xce, 0xb4, 0x18, 0x8c, 0xd3, 0xd5, 0x49, 0x54, 0x3a, 0x60, 0xe7, 0xb9, 0x0f, 0xd8, 0x62, 0x7e,
|
||||
0x91, 0x0c, 0x3e, 0x1a, 0xfc, 0x24, 0xee, 0xde, 0x19, 0x4c, 0xd7, 0xbd, 0x95, 0xe7, 0xf0, 0xdf,
|
||||
0xc9, 0x46, 0x15, 0xac, 0x64, 0x8b, 0xd9, 0x96, 0xde, 0xf9, 0x2d, 0x9c, 0x1f, 0x4d, 0xf4, 0x56,
|
||||
0xbe, 0xed, 0x89, 0x4d, 0x88, 0xcd, 0x87, 0xec, 0xa9, 0x57, 0x6e, 0x60, 0xee, 0x65, 0x50, 0xae,
|
||||
0x4d, 0xc6, 0x3f, 0x32, 0x20, 0x45, 0x24, 0x5c, 0x42, 0xf6, 0x6a, 0x6c, 0xab, 0x42, 0x31, 0x25,
|
||||
0x36, 0x54, 0xf9, 0x35, 0x80, 0x89, 0xfb, 0x83, 0xed, 0x62, 0xcf, 0xb2, 0x92, 0x2d, 0xce, 0xb6,
|
||||
0x33, 0x13, 0x57, 0x29, 0x58, 0x7e, 0x30, 0x28, 0x0e, 0xd8, 0xf0, 0xbf, 0xa6, 0x5e, 0x02, 0x8d,
|
||||
0xbc, 0xe9, 0xf7, 0xda, 0xb0, 0xe7, 0x87, 0xc1, 0xd1, 0x68, 0xa5, 0xd3, 0x1c, 0x83, 0xae, 0xb4,
|
||||
0x72, 0xb4, 0x75, 0x95, 0x90, 0xf4, 0x26, 0xfe, 0x3e, 0xcd, 0xfd, 0x58, 0x7d, 0x4e, 0xae, 0xd6,
|
||||
0xe9, 0x83, 0x95, 0xc5, 0xee, 0xc8, 0x1f, 0xc7, 0x56, 0x3b, 0xf1, 0xf5, 0x03, 0x6b, 0x82, 0xf5,
|
||||
0x08, 0xeb, 0x9d, 0x78, 0xc9, 0xa8, 0x89, 0xf8, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x95, 0xd1, 0xa1,
|
||||
0x34, 0x7e, 0x01, 0x00, 0x00,
|
||||
}
|
||||
+941
@@ -0,0 +1,941 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/monitoring/v3/group_service.proto
|
||||
|
||||
package monitoring // import "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import empty "github.com/golang/protobuf/ptypes/empty"
|
||||
import _ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
import monitoredres "google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
|
||||
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
|
||||
|
||||
// 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 `ListGroup` request.
|
||||
type ListGroupsRequest struct {
|
||||
// The project whose groups are to be listed. The format is
|
||||
// `"projects/{project_id_or_number}"`.
|
||||
Name string `protobuf:"bytes,7,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// An optional filter consisting of a single group name. The filters limit the
|
||||
// groups returned based on their parent-child relationship with the specified
|
||||
// group. If no filter is specified, all groups are returned.
|
||||
//
|
||||
// Types that are valid to be assigned to Filter:
|
||||
// *ListGroupsRequest_ChildrenOfGroup
|
||||
// *ListGroupsRequest_AncestorsOfGroup
|
||||
// *ListGroupsRequest_DescendantsOfGroup
|
||||
Filter isListGroupsRequest_Filter `protobuf_oneof:"filter"`
|
||||
// A positive number that is the maximum number of results to return.
|
||||
PageSize int32 `protobuf:"varint,5,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
|
||||
// If this field is not empty then it must contain the `nextPageToken` value
|
||||
// returned by a previous call to this method. Using this field causes the
|
||||
// method to return additional results from the previous method call.
|
||||
PageToken string `protobuf:"bytes,6,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListGroupsRequest) Reset() { *m = ListGroupsRequest{} }
|
||||
func (m *ListGroupsRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListGroupsRequest) ProtoMessage() {}
|
||||
func (*ListGroupsRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_group_service_460c0e48a72aa329, []int{0}
|
||||
}
|
||||
func (m *ListGroupsRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListGroupsRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListGroupsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListGroupsRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ListGroupsRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListGroupsRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *ListGroupsRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_ListGroupsRequest.Size(m)
|
||||
}
|
||||
func (m *ListGroupsRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListGroupsRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListGroupsRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *ListGroupsRequest) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type isListGroupsRequest_Filter interface {
|
||||
isListGroupsRequest_Filter()
|
||||
}
|
||||
|
||||
type ListGroupsRequest_ChildrenOfGroup struct {
|
||||
ChildrenOfGroup string `protobuf:"bytes,2,opt,name=children_of_group,json=childrenOfGroup,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ListGroupsRequest_AncestorsOfGroup struct {
|
||||
AncestorsOfGroup string `protobuf:"bytes,3,opt,name=ancestors_of_group,json=ancestorsOfGroup,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ListGroupsRequest_DescendantsOfGroup struct {
|
||||
DescendantsOfGroup string `protobuf:"bytes,4,opt,name=descendants_of_group,json=descendantsOfGroup,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*ListGroupsRequest_ChildrenOfGroup) isListGroupsRequest_Filter() {}
|
||||
|
||||
func (*ListGroupsRequest_AncestorsOfGroup) isListGroupsRequest_Filter() {}
|
||||
|
||||
func (*ListGroupsRequest_DescendantsOfGroup) isListGroupsRequest_Filter() {}
|
||||
|
||||
func (m *ListGroupsRequest) GetFilter() isListGroupsRequest_Filter {
|
||||
if m != nil {
|
||||
return m.Filter
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ListGroupsRequest) GetChildrenOfGroup() string {
|
||||
if x, ok := m.GetFilter().(*ListGroupsRequest_ChildrenOfGroup); ok {
|
||||
return x.ChildrenOfGroup
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ListGroupsRequest) GetAncestorsOfGroup() string {
|
||||
if x, ok := m.GetFilter().(*ListGroupsRequest_AncestorsOfGroup); ok {
|
||||
return x.AncestorsOfGroup
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ListGroupsRequest) GetDescendantsOfGroup() string {
|
||||
if x, ok := m.GetFilter().(*ListGroupsRequest_DescendantsOfGroup); ok {
|
||||
return x.DescendantsOfGroup
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ListGroupsRequest) GetPageSize() int32 {
|
||||
if m != nil {
|
||||
return m.PageSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ListGroupsRequest) GetPageToken() string {
|
||||
if m != nil {
|
||||
return m.PageToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*ListGroupsRequest) 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 _ListGroupsRequest_OneofMarshaler, _ListGroupsRequest_OneofUnmarshaler, _ListGroupsRequest_OneofSizer, []interface{}{
|
||||
(*ListGroupsRequest_ChildrenOfGroup)(nil),
|
||||
(*ListGroupsRequest_AncestorsOfGroup)(nil),
|
||||
(*ListGroupsRequest_DescendantsOfGroup)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _ListGroupsRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*ListGroupsRequest)
|
||||
// filter
|
||||
switch x := m.Filter.(type) {
|
||||
case *ListGroupsRequest_ChildrenOfGroup:
|
||||
b.EncodeVarint(2<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.ChildrenOfGroup)
|
||||
case *ListGroupsRequest_AncestorsOfGroup:
|
||||
b.EncodeVarint(3<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.AncestorsOfGroup)
|
||||
case *ListGroupsRequest_DescendantsOfGroup:
|
||||
b.EncodeVarint(4<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.DescendantsOfGroup)
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("ListGroupsRequest.Filter has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _ListGroupsRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*ListGroupsRequest)
|
||||
switch tag {
|
||||
case 2: // filter.children_of_group
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.Filter = &ListGroupsRequest_ChildrenOfGroup{x}
|
||||
return true, err
|
||||
case 3: // filter.ancestors_of_group
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.Filter = &ListGroupsRequest_AncestorsOfGroup{x}
|
||||
return true, err
|
||||
case 4: // filter.descendants_of_group
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.Filter = &ListGroupsRequest_DescendantsOfGroup{x}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _ListGroupsRequest_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*ListGroupsRequest)
|
||||
// filter
|
||||
switch x := m.Filter.(type) {
|
||||
case *ListGroupsRequest_ChildrenOfGroup:
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(len(x.ChildrenOfGroup)))
|
||||
n += len(x.ChildrenOfGroup)
|
||||
case *ListGroupsRequest_AncestorsOfGroup:
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(len(x.AncestorsOfGroup)))
|
||||
n += len(x.AncestorsOfGroup)
|
||||
case *ListGroupsRequest_DescendantsOfGroup:
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(len(x.DescendantsOfGroup)))
|
||||
n += len(x.DescendantsOfGroup)
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// The `ListGroups` response.
|
||||
type ListGroupsResponse struct {
|
||||
// The groups that match the specified filters.
|
||||
Group []*Group `protobuf:"bytes,1,rep,name=group,proto3" json:"group,omitempty"`
|
||||
// If there are more results than have been returned, then this field is set
|
||||
// to a non-empty value. To see the additional results,
|
||||
// use that value as `pageToken` in the next call to this method.
|
||||
NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListGroupsResponse) Reset() { *m = ListGroupsResponse{} }
|
||||
func (m *ListGroupsResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListGroupsResponse) ProtoMessage() {}
|
||||
func (*ListGroupsResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_group_service_460c0e48a72aa329, []int{1}
|
||||
}
|
||||
func (m *ListGroupsResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListGroupsResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListGroupsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListGroupsResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ListGroupsResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListGroupsResponse.Merge(dst, src)
|
||||
}
|
||||
func (m *ListGroupsResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_ListGroupsResponse.Size(m)
|
||||
}
|
||||
func (m *ListGroupsResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListGroupsResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListGroupsResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *ListGroupsResponse) GetGroup() []*Group {
|
||||
if m != nil {
|
||||
return m.Group
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ListGroupsResponse) GetNextPageToken() string {
|
||||
if m != nil {
|
||||
return m.NextPageToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// The `GetGroup` request.
|
||||
type GetGroupRequest struct {
|
||||
// The group to retrieve. The format is
|
||||
// `"projects/{project_id_or_number}/groups/{group_id}"`.
|
||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetGroupRequest) Reset() { *m = GetGroupRequest{} }
|
||||
func (m *GetGroupRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetGroupRequest) ProtoMessage() {}
|
||||
func (*GetGroupRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_group_service_460c0e48a72aa329, []int{2}
|
||||
}
|
||||
func (m *GetGroupRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetGroupRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetGroupRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetGroupRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *GetGroupRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetGroupRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *GetGroupRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_GetGroupRequest.Size(m)
|
||||
}
|
||||
func (m *GetGroupRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetGroupRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetGroupRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *GetGroupRequest) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// The `CreateGroup` request.
|
||||
type CreateGroupRequest struct {
|
||||
// The project in which to create the group. The format is
|
||||
// `"projects/{project_id_or_number}"`.
|
||||
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// A group definition. It is an error to define the `name` field because
|
||||
// the system assigns the name.
|
||||
Group *Group `protobuf:"bytes,2,opt,name=group,proto3" json:"group,omitempty"`
|
||||
// If true, validate this request but do not create the group.
|
||||
ValidateOnly bool `protobuf:"varint,3,opt,name=validate_only,json=validateOnly,proto3" json:"validate_only,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *CreateGroupRequest) Reset() { *m = CreateGroupRequest{} }
|
||||
func (m *CreateGroupRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateGroupRequest) ProtoMessage() {}
|
||||
func (*CreateGroupRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_group_service_460c0e48a72aa329, []int{3}
|
||||
}
|
||||
func (m *CreateGroupRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_CreateGroupRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *CreateGroupRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_CreateGroupRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *CreateGroupRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_CreateGroupRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *CreateGroupRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_CreateGroupRequest.Size(m)
|
||||
}
|
||||
func (m *CreateGroupRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_CreateGroupRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_CreateGroupRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *CreateGroupRequest) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CreateGroupRequest) GetGroup() *Group {
|
||||
if m != nil {
|
||||
return m.Group
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CreateGroupRequest) GetValidateOnly() bool {
|
||||
if m != nil {
|
||||
return m.ValidateOnly
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// The `UpdateGroup` request.
|
||||
type UpdateGroupRequest struct {
|
||||
// The new definition of the group. All fields of the existing group,
|
||||
// excepting `name`, are replaced with the corresponding fields of this group.
|
||||
Group *Group `protobuf:"bytes,2,opt,name=group,proto3" json:"group,omitempty"`
|
||||
// If true, validate this request but do not update the existing group.
|
||||
ValidateOnly bool `protobuf:"varint,3,opt,name=validate_only,json=validateOnly,proto3" json:"validate_only,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *UpdateGroupRequest) Reset() { *m = UpdateGroupRequest{} }
|
||||
func (m *UpdateGroupRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*UpdateGroupRequest) ProtoMessage() {}
|
||||
func (*UpdateGroupRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_group_service_460c0e48a72aa329, []int{4}
|
||||
}
|
||||
func (m *UpdateGroupRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UpdateGroupRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *UpdateGroupRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_UpdateGroupRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *UpdateGroupRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_UpdateGroupRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *UpdateGroupRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_UpdateGroupRequest.Size(m)
|
||||
}
|
||||
func (m *UpdateGroupRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_UpdateGroupRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_UpdateGroupRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *UpdateGroupRequest) GetGroup() *Group {
|
||||
if m != nil {
|
||||
return m.Group
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UpdateGroupRequest) GetValidateOnly() bool {
|
||||
if m != nil {
|
||||
return m.ValidateOnly
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// The `DeleteGroup` request. You can only delete a group if it has no children.
|
||||
type DeleteGroupRequest struct {
|
||||
// The group to delete. The format is
|
||||
// `"projects/{project_id_or_number}/groups/{group_id}"`.
|
||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *DeleteGroupRequest) Reset() { *m = DeleteGroupRequest{} }
|
||||
func (m *DeleteGroupRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*DeleteGroupRequest) ProtoMessage() {}
|
||||
func (*DeleteGroupRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_group_service_460c0e48a72aa329, []int{5}
|
||||
}
|
||||
func (m *DeleteGroupRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_DeleteGroupRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *DeleteGroupRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_DeleteGroupRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *DeleteGroupRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_DeleteGroupRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *DeleteGroupRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_DeleteGroupRequest.Size(m)
|
||||
}
|
||||
func (m *DeleteGroupRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_DeleteGroupRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_DeleteGroupRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *DeleteGroupRequest) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// The `ListGroupMembers` request.
|
||||
type ListGroupMembersRequest struct {
|
||||
// The group whose members are listed. The format is
|
||||
// `"projects/{project_id_or_number}/groups/{group_id}"`.
|
||||
Name string `protobuf:"bytes,7,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// A positive number that is the maximum number of results to return.
|
||||
PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
|
||||
// If this field is not empty then it must contain the `nextPageToken` value
|
||||
// returned by a previous call to this method. Using this field causes the
|
||||
// method to return additional results from the previous method call.
|
||||
PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
|
||||
// An optional [list filter](/monitoring/api/learn_more#filtering) describing
|
||||
// the members to be returned. The filter may reference the type, labels, and
|
||||
// metadata of monitored resources that comprise the group.
|
||||
// For example, to return only resources representing Compute Engine VM
|
||||
// instances, use this filter:
|
||||
//
|
||||
// resource.type = "gce_instance"
|
||||
Filter string `protobuf:"bytes,5,opt,name=filter,proto3" json:"filter,omitempty"`
|
||||
// An optional time interval for which results should be returned. Only
|
||||
// members that were part of the group during the specified interval are
|
||||
// included in the response. If no interval is provided then the group
|
||||
// membership over the last minute is returned.
|
||||
Interval *TimeInterval `protobuf:"bytes,6,opt,name=interval,proto3" json:"interval,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListGroupMembersRequest) Reset() { *m = ListGroupMembersRequest{} }
|
||||
func (m *ListGroupMembersRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListGroupMembersRequest) ProtoMessage() {}
|
||||
func (*ListGroupMembersRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_group_service_460c0e48a72aa329, []int{6}
|
||||
}
|
||||
func (m *ListGroupMembersRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListGroupMembersRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListGroupMembersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListGroupMembersRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ListGroupMembersRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListGroupMembersRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *ListGroupMembersRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_ListGroupMembersRequest.Size(m)
|
||||
}
|
||||
func (m *ListGroupMembersRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListGroupMembersRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListGroupMembersRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *ListGroupMembersRequest) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ListGroupMembersRequest) GetPageSize() int32 {
|
||||
if m != nil {
|
||||
return m.PageSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ListGroupMembersRequest) GetPageToken() string {
|
||||
if m != nil {
|
||||
return m.PageToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ListGroupMembersRequest) GetFilter() string {
|
||||
if m != nil {
|
||||
return m.Filter
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ListGroupMembersRequest) GetInterval() *TimeInterval {
|
||||
if m != nil {
|
||||
return m.Interval
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// The `ListGroupMembers` response.
|
||||
type ListGroupMembersResponse struct {
|
||||
// A set of monitored resources in the group.
|
||||
Members []*monitoredres.MonitoredResource `protobuf:"bytes,1,rep,name=members,proto3" json:"members,omitempty"`
|
||||
// If there are more results than have been returned, then this field is
|
||||
// set to a non-empty value. To see the additional results, use that value as
|
||||
// `pageToken` in the next call to this method.
|
||||
NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
|
||||
// The total number of elements matching this request.
|
||||
TotalSize int32 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListGroupMembersResponse) Reset() { *m = ListGroupMembersResponse{} }
|
||||
func (m *ListGroupMembersResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListGroupMembersResponse) ProtoMessage() {}
|
||||
func (*ListGroupMembersResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_group_service_460c0e48a72aa329, []int{7}
|
||||
}
|
||||
func (m *ListGroupMembersResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListGroupMembersResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListGroupMembersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListGroupMembersResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ListGroupMembersResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListGroupMembersResponse.Merge(dst, src)
|
||||
}
|
||||
func (m *ListGroupMembersResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_ListGroupMembersResponse.Size(m)
|
||||
}
|
||||
func (m *ListGroupMembersResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListGroupMembersResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListGroupMembersResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *ListGroupMembersResponse) GetMembers() []*monitoredres.MonitoredResource {
|
||||
if m != nil {
|
||||
return m.Members
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ListGroupMembersResponse) GetNextPageToken() string {
|
||||
if m != nil {
|
||||
return m.NextPageToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ListGroupMembersResponse) GetTotalSize() int32 {
|
||||
if m != nil {
|
||||
return m.TotalSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*ListGroupsRequest)(nil), "google.monitoring.v3.ListGroupsRequest")
|
||||
proto.RegisterType((*ListGroupsResponse)(nil), "google.monitoring.v3.ListGroupsResponse")
|
||||
proto.RegisterType((*GetGroupRequest)(nil), "google.monitoring.v3.GetGroupRequest")
|
||||
proto.RegisterType((*CreateGroupRequest)(nil), "google.monitoring.v3.CreateGroupRequest")
|
||||
proto.RegisterType((*UpdateGroupRequest)(nil), "google.monitoring.v3.UpdateGroupRequest")
|
||||
proto.RegisterType((*DeleteGroupRequest)(nil), "google.monitoring.v3.DeleteGroupRequest")
|
||||
proto.RegisterType((*ListGroupMembersRequest)(nil), "google.monitoring.v3.ListGroupMembersRequest")
|
||||
proto.RegisterType((*ListGroupMembersResponse)(nil), "google.monitoring.v3.ListGroupMembersResponse")
|
||||
}
|
||||
|
||||
// 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.SupportPackageIsVersion4
|
||||
|
||||
// GroupServiceClient is the client API for GroupService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type GroupServiceClient interface {
|
||||
// Lists the existing groups.
|
||||
ListGroups(ctx context.Context, in *ListGroupsRequest, opts ...grpc.CallOption) (*ListGroupsResponse, error)
|
||||
// Gets a single group.
|
||||
GetGroup(ctx context.Context, in *GetGroupRequest, opts ...grpc.CallOption) (*Group, error)
|
||||
// Creates a new group.
|
||||
CreateGroup(ctx context.Context, in *CreateGroupRequest, opts ...grpc.CallOption) (*Group, error)
|
||||
// Updates an existing group.
|
||||
// You can change any group attributes except `name`.
|
||||
UpdateGroup(ctx context.Context, in *UpdateGroupRequest, opts ...grpc.CallOption) (*Group, error)
|
||||
// Deletes an existing group.
|
||||
DeleteGroup(ctx context.Context, in *DeleteGroupRequest, opts ...grpc.CallOption) (*empty.Empty, error)
|
||||
// Lists the monitored resources that are members of a group.
|
||||
ListGroupMembers(ctx context.Context, in *ListGroupMembersRequest, opts ...grpc.CallOption) (*ListGroupMembersResponse, error)
|
||||
}
|
||||
|
||||
type groupServiceClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewGroupServiceClient(cc *grpc.ClientConn) GroupServiceClient {
|
||||
return &groupServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *groupServiceClient) ListGroups(ctx context.Context, in *ListGroupsRequest, opts ...grpc.CallOption) (*ListGroupsResponse, error) {
|
||||
out := new(ListGroupsResponse)
|
||||
err := c.cc.Invoke(ctx, "/google.monitoring.v3.GroupService/ListGroups", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *groupServiceClient) GetGroup(ctx context.Context, in *GetGroupRequest, opts ...grpc.CallOption) (*Group, error) {
|
||||
out := new(Group)
|
||||
err := c.cc.Invoke(ctx, "/google.monitoring.v3.GroupService/GetGroup", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *groupServiceClient) CreateGroup(ctx context.Context, in *CreateGroupRequest, opts ...grpc.CallOption) (*Group, error) {
|
||||
out := new(Group)
|
||||
err := c.cc.Invoke(ctx, "/google.monitoring.v3.GroupService/CreateGroup", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *groupServiceClient) UpdateGroup(ctx context.Context, in *UpdateGroupRequest, opts ...grpc.CallOption) (*Group, error) {
|
||||
out := new(Group)
|
||||
err := c.cc.Invoke(ctx, "/google.monitoring.v3.GroupService/UpdateGroup", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *groupServiceClient) DeleteGroup(ctx context.Context, in *DeleteGroupRequest, opts ...grpc.CallOption) (*empty.Empty, error) {
|
||||
out := new(empty.Empty)
|
||||
err := c.cc.Invoke(ctx, "/google.monitoring.v3.GroupService/DeleteGroup", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *groupServiceClient) ListGroupMembers(ctx context.Context, in *ListGroupMembersRequest, opts ...grpc.CallOption) (*ListGroupMembersResponse, error) {
|
||||
out := new(ListGroupMembersResponse)
|
||||
err := c.cc.Invoke(ctx, "/google.monitoring.v3.GroupService/ListGroupMembers", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// GroupServiceServer is the server API for GroupService service.
|
||||
type GroupServiceServer interface {
|
||||
// Lists the existing groups.
|
||||
ListGroups(context.Context, *ListGroupsRequest) (*ListGroupsResponse, error)
|
||||
// Gets a single group.
|
||||
GetGroup(context.Context, *GetGroupRequest) (*Group, error)
|
||||
// Creates a new group.
|
||||
CreateGroup(context.Context, *CreateGroupRequest) (*Group, error)
|
||||
// Updates an existing group.
|
||||
// You can change any group attributes except `name`.
|
||||
UpdateGroup(context.Context, *UpdateGroupRequest) (*Group, error)
|
||||
// Deletes an existing group.
|
||||
DeleteGroup(context.Context, *DeleteGroupRequest) (*empty.Empty, error)
|
||||
// Lists the monitored resources that are members of a group.
|
||||
ListGroupMembers(context.Context, *ListGroupMembersRequest) (*ListGroupMembersResponse, error)
|
||||
}
|
||||
|
||||
func RegisterGroupServiceServer(s *grpc.Server, srv GroupServiceServer) {
|
||||
s.RegisterService(&_GroupService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _GroupService_ListGroups_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListGroupsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(GroupServiceServer).ListGroups(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.monitoring.v3.GroupService/ListGroups",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(GroupServiceServer).ListGroups(ctx, req.(*ListGroupsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _GroupService_GetGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetGroupRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(GroupServiceServer).GetGroup(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.monitoring.v3.GroupService/GetGroup",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(GroupServiceServer).GetGroup(ctx, req.(*GetGroupRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _GroupService_CreateGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateGroupRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(GroupServiceServer).CreateGroup(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.monitoring.v3.GroupService/CreateGroup",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(GroupServiceServer).CreateGroup(ctx, req.(*CreateGroupRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _GroupService_UpdateGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateGroupRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(GroupServiceServer).UpdateGroup(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.monitoring.v3.GroupService/UpdateGroup",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(GroupServiceServer).UpdateGroup(ctx, req.(*UpdateGroupRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _GroupService_DeleteGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteGroupRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(GroupServiceServer).DeleteGroup(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.monitoring.v3.GroupService/DeleteGroup",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(GroupServiceServer).DeleteGroup(ctx, req.(*DeleteGroupRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _GroupService_ListGroupMembers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListGroupMembersRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(GroupServiceServer).ListGroupMembers(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.monitoring.v3.GroupService/ListGroupMembers",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(GroupServiceServer).ListGroupMembers(ctx, req.(*ListGroupMembersRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _GroupService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "google.monitoring.v3.GroupService",
|
||||
HandlerType: (*GroupServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "ListGroups",
|
||||
Handler: _GroupService_ListGroups_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetGroup",
|
||||
Handler: _GroupService_GetGroup_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateGroup",
|
||||
Handler: _GroupService_CreateGroup_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateGroup",
|
||||
Handler: _GroupService_UpdateGroup_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteGroup",
|
||||
Handler: _GroupService_DeleteGroup_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListGroupMembers",
|
||||
Handler: _GroupService_ListGroupMembers_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "google/monitoring/v3/group_service.proto",
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google/monitoring/v3/group_service.proto", fileDescriptor_group_service_460c0e48a72aa329)
|
||||
}
|
||||
|
||||
var fileDescriptor_group_service_460c0e48a72aa329 = []byte{
|
||||
// 826 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x4d, 0x6f, 0xd3, 0x4c,
|
||||
0x10, 0x7e, 0xdd, 0xa4, 0x69, 0xb2, 0x69, 0xd5, 0x76, 0x55, 0xf5, 0x8d, 0xdc, 0x0f, 0x05, 0xf7,
|
||||
0x83, 0xa8, 0x50, 0x5b, 0x24, 0x07, 0x24, 0x10, 0x3d, 0xb4, 0xa0, 0x82, 0x44, 0xd5, 0xca, 0x2d,
|
||||
0x3d, 0xa0, 0x4a, 0x91, 0x9b, 0x4c, 0x8c, 0xc1, 0xde, 0x35, 0xf6, 0x26, 0xd0, 0xa2, 0x4a, 0x80,
|
||||
0xc4, 0x81, 0x33, 0x37, 0x6e, 0x1c, 0xe1, 0x2f, 0x70, 0xe2, 0xca, 0x95, 0xbf, 0xc0, 0xff, 0x00,
|
||||
0x79, 0xbd, 0x9b, 0x38, 0x9f, 0xed, 0x85, 0x5b, 0xb2, 0xf3, 0x8c, 0x9f, 0x67, 0x66, 0x9f, 0x99,
|
||||
0x45, 0x25, 0x9b, 0x52, 0xdb, 0x05, 0xc3, 0xa3, 0xc4, 0x61, 0x34, 0x70, 0x88, 0x6d, 0xb4, 0x2a,
|
||||
0x86, 0x1d, 0xd0, 0xa6, 0x5f, 0x0d, 0x21, 0x68, 0x39, 0x35, 0xd0, 0xfd, 0x80, 0x32, 0x8a, 0xe7,
|
||||
0x62, 0xa4, 0xde, 0x41, 0xea, 0xad, 0x8a, 0xba, 0x28, 0xf2, 0x2d, 0xdf, 0x31, 0x2c, 0x42, 0x28,
|
||||
0xb3, 0x98, 0x43, 0x49, 0x18, 0xe7, 0xa8, 0x2b, 0x89, 0xa8, 0xc8, 0x83, 0x7a, 0x35, 0x80, 0x90,
|
||||
0x36, 0x03, 0xf9, 0x61, 0xf5, 0xda, 0x40, 0x09, 0x35, 0xea, 0x79, 0x94, 0x08, 0x48, 0x71, 0xb8,
|
||||
0x4a, 0x81, 0x58, 0x10, 0x08, 0xfe, 0xef, 0xb4, 0xd9, 0x30, 0xc0, 0xf3, 0xd9, 0x59, 0x1c, 0xd4,
|
||||
0xfe, 0x28, 0x68, 0xf6, 0xb1, 0x13, 0xb2, 0xdd, 0x28, 0x21, 0x34, 0xe1, 0x65, 0x13, 0x42, 0x86,
|
||||
0x31, 0x4a, 0x13, 0xcb, 0x83, 0xc2, 0x44, 0x51, 0x29, 0xe5, 0x4c, 0xfe, 0x1b, 0xdf, 0x44, 0xb3,
|
||||
0xb5, 0x67, 0x8e, 0x5b, 0x0f, 0x80, 0x54, 0x69, 0xa3, 0xca, 0x19, 0x0a, 0x63, 0x11, 0xe0, 0xe1,
|
||||
0x7f, 0xe6, 0xb4, 0x0c, 0xed, 0x37, 0xf8, 0x97, 0xb0, 0x8e, 0xb0, 0x45, 0x6a, 0x10, 0x32, 0x1a,
|
||||
0x84, 0x1d, 0x78, 0x4a, 0xc0, 0x67, 0xda, 0x31, 0x89, 0x2f, 0xa3, 0xb9, 0x3a, 0x84, 0x35, 0x20,
|
||||
0x75, 0x8b, 0xb0, 0x44, 0x46, 0x5a, 0x64, 0xe0, 0x44, 0x54, 0xe6, 0x2c, 0xa0, 0x9c, 0x6f, 0xd9,
|
||||
0x50, 0x0d, 0x9d, 0x73, 0x28, 0x8c, 0x17, 0x95, 0xd2, 0xb8, 0x99, 0x8d, 0x0e, 0x0e, 0x9d, 0x73,
|
||||
0xc0, 0x4b, 0x08, 0xf1, 0x20, 0xa3, 0x2f, 0x80, 0x14, 0x32, 0xbc, 0x10, 0x0e, 0x3f, 0x8a, 0x0e,
|
||||
0xb6, 0xb3, 0x28, 0xd3, 0x70, 0x5c, 0x06, 0x81, 0x46, 0x11, 0x4e, 0x36, 0x20, 0xf4, 0x29, 0x09,
|
||||
0x01, 0xdf, 0x42, 0xe3, 0xb1, 0x00, 0xa5, 0x98, 0x2a, 0xe5, 0xcb, 0x0b, 0xfa, 0xa0, 0x2b, 0xd6,
|
||||
0x79, 0x92, 0x19, 0x23, 0xf1, 0x3a, 0x9a, 0x26, 0xf0, 0x9a, 0x55, 0x13, 0xb4, 0xbc, 0x3d, 0xe6,
|
||||
0x54, 0x74, 0x7c, 0x20, 0xa9, 0xb5, 0x35, 0x34, 0xbd, 0x0b, 0x31, 0x5f, 0x6f, 0xbf, 0x53, 0x9d,
|
||||
0x7e, 0x6b, 0x6f, 0x15, 0x84, 0x77, 0x02, 0xb0, 0x18, 0x0c, 0x84, 0xa6, 0x13, 0x57, 0xd3, 0x16,
|
||||
0x1b, 0xf1, 0x5d, 0x4d, 0xec, 0x0a, 0x9a, 0x6a, 0x59, 0xae, 0x53, 0xb7, 0x18, 0x54, 0x29, 0x71,
|
||||
0xcf, 0x38, 0x75, 0xd6, 0x9c, 0x94, 0x87, 0xfb, 0xc4, 0x3d, 0xd3, 0x5c, 0x84, 0x9f, 0xf8, 0xf5,
|
||||
0x5e, 0x05, 0xff, 0x8a, 0xad, 0x84, 0xf0, 0x7d, 0x70, 0x61, 0x48, 0xbd, 0xc9, 0xd6, 0xfc, 0x50,
|
||||
0xd0, 0xff, 0xed, 0x3b, 0xdb, 0x03, 0xef, 0x14, 0x82, 0x91, 0xd6, 0xed, 0x32, 0x4a, 0x6a, 0xa4,
|
||||
0x51, 0xd2, 0x3d, 0x46, 0xc1, 0xf3, 0xd2, 0x28, 0xdc, 0x61, 0x39, 0x53, 0xfc, 0xc3, 0x5b, 0x28,
|
||||
0xeb, 0x10, 0x06, 0x41, 0xcb, 0x72, 0xb9, 0xbb, 0xf2, 0x65, 0x6d, 0x70, 0x23, 0x8e, 0x1c, 0x0f,
|
||||
0x1e, 0x09, 0xa4, 0xd9, 0xce, 0xd1, 0x3e, 0x2b, 0xa8, 0xd0, 0x5f, 0x83, 0x70, 0xdf, 0x6d, 0x34,
|
||||
0xe1, 0xc5, 0x47, 0xc2, 0x7f, 0x4b, 0xf2, 0xdb, 0x96, 0xef, 0xe8, 0x7b, 0x72, 0x5d, 0x98, 0x62,
|
||||
0x5b, 0x98, 0x12, 0x7d, 0x55, 0x0f, 0x46, 0x45, 0x33, 0xca, 0x2c, 0x37, 0xd9, 0x92, 0x1c, 0x3f,
|
||||
0x89, 0x7a, 0x52, 0xfe, 0x9e, 0x41, 0x93, 0x5c, 0xd8, 0x61, 0xbc, 0xe7, 0xf0, 0x07, 0x05, 0xa1,
|
||||
0xce, 0x94, 0xe0, 0xeb, 0x83, 0x4b, 0xed, 0x5b, 0x24, 0x6a, 0xe9, 0x72, 0x60, 0x5c, 0xb2, 0xb6,
|
||||
0xfa, 0xfe, 0xd7, 0xef, 0x4f, 0x63, 0xcb, 0x78, 0x31, 0x5a, 0x5f, 0x6f, 0xa2, 0x6b, 0xbb, 0xe7,
|
||||
0x07, 0xf4, 0x39, 0xd4, 0x58, 0x68, 0x6c, 0x5c, 0xc4, 0x0b, 0x2d, 0xc4, 0x2d, 0x94, 0x95, 0xb3,
|
||||
0x83, 0xd7, 0x86, 0x18, 0xaf, 0x7b, 0xb6, 0xd4, 0x51, 0xfe, 0xd4, 0xd6, 0x39, 0x6b, 0x11, 0x2f,
|
||||
0x0f, 0x62, 0x15, 0xa4, 0xc6, 0xc6, 0x05, 0x7e, 0xa7, 0xa0, 0x7c, 0x62, 0x18, 0xf1, 0x90, 0xba,
|
||||
0xfa, 0xe7, 0x75, 0x34, 0xfd, 0x0d, 0x4e, 0xbf, 0xa6, 0x8d, 0x2c, 0xfa, 0x8e, 0x18, 0xa2, 0x8f,
|
||||
0x0a, 0xca, 0x27, 0xc6, 0x71, 0x98, 0x86, 0xfe, 0x89, 0x1d, 0xad, 0xa1, 0xc2, 0x35, 0x6c, 0xaa,
|
||||
0xab, 0x5c, 0x43, 0xfc, 0x70, 0x0c, 0x6d, 0x84, 0xd4, 0xf2, 0x0a, 0xe5, 0x13, 0xb3, 0x3a, 0x4c,
|
||||
0x4a, 0xff, 0x38, 0xab, 0xf3, 0x12, 0x29, 0x5f, 0x23, 0xfd, 0x41, 0xf4, 0x1a, 0xc9, 0x8b, 0xd8,
|
||||
0xb8, 0xec, 0x22, 0xbe, 0x28, 0x68, 0xa6, 0x77, 0x6c, 0xf0, 0xe6, 0x25, 0x2e, 0xeb, 0x5e, 0x11,
|
||||
0xaa, 0x7e, 0x55, 0xb8, 0xb0, 0xa6, 0xce, 0xb5, 0x95, 0xf0, 0xfa, 0x68, 0x6d, 0x86, 0x18, 0xc2,
|
||||
0xed, 0xaf, 0x0a, 0x2a, 0xd4, 0xa8, 0x37, 0x90, 0x65, 0x7b, 0x36, 0x39, 0x57, 0x07, 0x51, 0x13,
|
||||
0x0e, 0x94, 0xa7, 0x5b, 0x02, 0x6a, 0x53, 0xd7, 0x22, 0xb6, 0x4e, 0x03, 0xdb, 0xb0, 0x81, 0xf0,
|
||||
0x16, 0x19, 0x71, 0xc8, 0xf2, 0x9d, 0xb0, 0xfb, 0x8d, 0xbf, 0xdb, 0xf9, 0xf7, 0x6d, 0x4c, 0xdd,
|
||||
0x8d, 0x3f, 0xb0, 0xe3, 0xd2, 0x66, 0x5d, 0x2e, 0x88, 0x88, 0xf1, 0xb8, 0xf2, 0x53, 0x06, 0x4f,
|
||||
0x78, 0xf0, 0xa4, 0x13, 0x3c, 0x39, 0xae, 0x9c, 0x66, 0x38, 0x49, 0xe5, 0x6f, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0x86, 0x94, 0xf2, 0xde, 0xed, 0x08, 0x00, 0x00,
|
||||
}
|
||||
+232
@@ -0,0 +1,232 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/monitoring/v3/metric.proto
|
||||
|
||||
package monitoring // import "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
import _ "google.golang.org/genproto/googleapis/api/label"
|
||||
import metric "google.golang.org/genproto/googleapis/api/metric"
|
||||
import monitoredres "google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
|
||||
// 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 single data point in a time series.
|
||||
type Point struct {
|
||||
// The time interval to which the data point applies. For `GAUGE` metrics,
|
||||
// only the end time of the interval is used. For `DELTA` metrics, the start
|
||||
// and end time should specify a non-zero interval, with subsequent points
|
||||
// specifying contiguous and non-overlapping intervals. For `CUMULATIVE`
|
||||
// metrics, the start and end time should specify a non-zero interval, with
|
||||
// subsequent points specifying 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.
|
||||
Interval *TimeInterval `protobuf:"bytes,1,opt,name=interval,proto3" json:"interval,omitempty"`
|
||||
// The value of the data point.
|
||||
Value *TypedValue `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Point) Reset() { *m = Point{} }
|
||||
func (m *Point) String() string { return proto.CompactTextString(m) }
|
||||
func (*Point) ProtoMessage() {}
|
||||
func (*Point) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_metric_360b9781a7cf8bf5, []int{0}
|
||||
}
|
||||
func (m *Point) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Point.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Point) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Point.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Point) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Point.Merge(dst, src)
|
||||
}
|
||||
func (m *Point) XXX_Size() int {
|
||||
return xxx_messageInfo_Point.Size(m)
|
||||
}
|
||||
func (m *Point) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Point.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Point proto.InternalMessageInfo
|
||||
|
||||
func (m *Point) GetInterval() *TimeInterval {
|
||||
if m != nil {
|
||||
return m.Interval
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Point) GetValue() *TypedValue {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A collection of data points that describes the time-varying values
|
||||
// of a metric. A time series is identified by a combination of a
|
||||
// fully-specified monitored resource and a fully-specified metric.
|
||||
// This type is used for both listing and creating time series.
|
||||
type TimeSeries struct {
|
||||
// The associated metric. A fully-specified metric used to identify the time
|
||||
// series.
|
||||
Metric *metric.Metric `protobuf:"bytes,1,opt,name=metric,proto3" json:"metric,omitempty"`
|
||||
// The associated monitored resource. Custom metrics can use only certain
|
||||
// monitored resource types in their time series data.
|
||||
Resource *monitoredres.MonitoredResource `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"`
|
||||
// Output only. The associated monitored resource metadata. When reading a
|
||||
// a timeseries, this field will include metadata labels that are explicitly
|
||||
// named in the reduction. When creating a timeseries, this field is ignored.
|
||||
Metadata *monitoredres.MonitoredResourceMetadata `protobuf:"bytes,7,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||
// The metric kind of the time series. When listing time series, this metric
|
||||
// kind might be different from the metric kind of the associated metric if
|
||||
// this time series is an alignment or reduction of other time series.
|
||||
//
|
||||
// When creating a time series, this field is optional. If present, it must be
|
||||
// the same as the metric kind of the associated metric. If the associated
|
||||
// metric's descriptor must be auto-created, then this field specifies the
|
||||
// metric kind of the new descriptor and must be either `GAUGE` (the default)
|
||||
// or `CUMULATIVE`.
|
||||
MetricKind metric.MetricDescriptor_MetricKind `protobuf:"varint,3,opt,name=metric_kind,json=metricKind,proto3,enum=google.api.MetricDescriptor_MetricKind" json:"metric_kind,omitempty"`
|
||||
// The value type of the time series. When listing time series, this value
|
||||
// type might be different from the value type of the associated metric if
|
||||
// this time series is an alignment or reduction of other time series.
|
||||
//
|
||||
// When creating a time series, this field is optional. If present, it must be
|
||||
// the same as the type of the data in the `points` field.
|
||||
ValueType metric.MetricDescriptor_ValueType `protobuf:"varint,4,opt,name=value_type,json=valueType,proto3,enum=google.api.MetricDescriptor_ValueType" json:"value_type,omitempty"`
|
||||
// The data points of this time series. When listing time series, points are
|
||||
// returned in reverse time order.
|
||||
//
|
||||
// When creating a time series, this field must contain exactly one point and
|
||||
// the point's type must be the same as the value type of the associated
|
||||
// metric. If the associated metric's descriptor must be auto-created, then
|
||||
// the value type of the descriptor is determined by the point's type, which
|
||||
// must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`.
|
||||
Points []*Point `protobuf:"bytes,5,rep,name=points,proto3" json:"points,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *TimeSeries) Reset() { *m = TimeSeries{} }
|
||||
func (m *TimeSeries) String() string { return proto.CompactTextString(m) }
|
||||
func (*TimeSeries) ProtoMessage() {}
|
||||
func (*TimeSeries) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_metric_360b9781a7cf8bf5, []int{1}
|
||||
}
|
||||
func (m *TimeSeries) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_TimeSeries.Unmarshal(m, b)
|
||||
}
|
||||
func (m *TimeSeries) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_TimeSeries.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *TimeSeries) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_TimeSeries.Merge(dst, src)
|
||||
}
|
||||
func (m *TimeSeries) XXX_Size() int {
|
||||
return xxx_messageInfo_TimeSeries.Size(m)
|
||||
}
|
||||
func (m *TimeSeries) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_TimeSeries.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_TimeSeries proto.InternalMessageInfo
|
||||
|
||||
func (m *TimeSeries) GetMetric() *metric.Metric {
|
||||
if m != nil {
|
||||
return m.Metric
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TimeSeries) GetResource() *monitoredres.MonitoredResource {
|
||||
if m != nil {
|
||||
return m.Resource
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TimeSeries) GetMetadata() *monitoredres.MonitoredResourceMetadata {
|
||||
if m != nil {
|
||||
return m.Metadata
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TimeSeries) GetMetricKind() metric.MetricDescriptor_MetricKind {
|
||||
if m != nil {
|
||||
return m.MetricKind
|
||||
}
|
||||
return metric.MetricDescriptor_METRIC_KIND_UNSPECIFIED
|
||||
}
|
||||
|
||||
func (m *TimeSeries) GetValueType() metric.MetricDescriptor_ValueType {
|
||||
if m != nil {
|
||||
return m.ValueType
|
||||
}
|
||||
return metric.MetricDescriptor_VALUE_TYPE_UNSPECIFIED
|
||||
}
|
||||
|
||||
func (m *TimeSeries) GetPoints() []*Point {
|
||||
if m != nil {
|
||||
return m.Points
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Point)(nil), "google.monitoring.v3.Point")
|
||||
proto.RegisterType((*TimeSeries)(nil), "google.monitoring.v3.TimeSeries")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google/monitoring/v3/metric.proto", fileDescriptor_metric_360b9781a7cf8bf5)
|
||||
}
|
||||
|
||||
var fileDescriptor_metric_360b9781a7cf8bf5 = []byte{
|
||||
// 441 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x51, 0xab, 0xd3, 0x30,
|
||||
0x14, 0xc7, 0xe9, 0xae, 0x9b, 0x33, 0x03, 0x1f, 0x82, 0x68, 0x99, 0x0a, 0x73, 0xa2, 0x0e, 0x1f,
|
||||
0x5a, 0x58, 0x41, 0x10, 0xe1, 0x82, 0x57, 0x45, 0x45, 0x2e, 0x8c, 0x28, 0x7b, 0x90, 0xc1, 0xc8,
|
||||
0x6d, 0x0f, 0x25, 0xd8, 0xe4, 0x84, 0x34, 0x2b, 0xdc, 0x27, 0x3f, 0x8c, 0x6f, 0x7e, 0x14, 0x3f,
|
||||
0x93, 0x0f, 0xd2, 0x24, 0xdd, 0x76, 0xb1, 0xf7, 0xbe, 0xb5, 0xf9, 0xff, 0xfe, 0xe7, 0x7f, 0x72,
|
||||
0x72, 0xc8, 0x93, 0x12, 0xb1, 0xac, 0x20, 0x95, 0xa8, 0x84, 0x45, 0x23, 0x54, 0x99, 0x36, 0x59,
|
||||
0x2a, 0xc1, 0x1a, 0x91, 0x27, 0xda, 0xa0, 0x45, 0x7a, 0xcf, 0x23, 0xc9, 0x01, 0x49, 0x9a, 0x6c,
|
||||
0xfa, 0x28, 0x18, 0xb9, 0x16, 0x29, 0x57, 0x0a, 0x2d, 0xb7, 0x02, 0x55, 0xed, 0x3d, 0xd3, 0xfb,
|
||||
0x47, 0x6a, 0xc5, 0x2f, 0xa0, 0x0a, 0xe7, 0x0f, 0x8e, 0xce, 0x8f, 0x43, 0xa6, 0x4f, 0x8f, 0x05,
|
||||
0x1f, 0x04, 0xc5, 0xd6, 0x40, 0x8d, 0x3b, 0x93, 0x43, 0x80, 0xfa, 0x9b, 0xcd, 0x51, 0x4a, 0x54,
|
||||
0x1e, 0x99, 0xff, 0x24, 0xc3, 0x15, 0x0a, 0x65, 0xe9, 0x29, 0x19, 0x0b, 0x65, 0xc1, 0x34, 0xbc,
|
||||
0x8a, 0xa3, 0x59, 0xb4, 0x98, 0x2c, 0xe7, 0x49, 0xdf, 0x45, 0x92, 0x6f, 0x42, 0xc2, 0xe7, 0x40,
|
||||
0xb2, 0xbd, 0x87, 0xbe, 0x22, 0xc3, 0x86, 0x57, 0x3b, 0x88, 0x07, 0xce, 0x3c, 0xbb, 0xc6, 0x7c,
|
||||
0xa9, 0xa1, 0x58, 0xb7, 0x1c, 0xf3, 0xf8, 0xfc, 0xef, 0x80, 0x90, 0xb6, 0xe4, 0x57, 0x30, 0x02,
|
||||
0x6a, 0xfa, 0x92, 0x8c, 0xfc, 0x3d, 0x43, 0x13, 0xb4, 0xab, 0xc3, 0xb5, 0x48, 0xce, 0x9d, 0xc2,
|
||||
0x02, 0x41, 0x5f, 0x93, 0x71, 0x77, 0xe1, 0x90, 0xfa, 0xf8, 0x0a, 0xdd, 0x8d, 0x85, 0x05, 0x88,
|
||||
0xed, 0x71, 0xfa, 0x96, 0x8c, 0x25, 0x58, 0x5e, 0x70, 0xcb, 0xe3, 0xdb, 0xce, 0xfa, 0xec, 0x46,
|
||||
0xeb, 0x79, 0x80, 0xd9, 0xde, 0x46, 0x3f, 0x91, 0x89, 0xef, 0x63, 0xfb, 0x43, 0xa8, 0x22, 0x3e,
|
||||
0x99, 0x45, 0x8b, 0xbb, 0xcb, 0x17, 0xff, 0xb7, 0xfb, 0x1e, 0xea, 0xdc, 0x08, 0x6d, 0xd1, 0x84,
|
||||
0x83, 0x2f, 0x42, 0x15, 0x8c, 0xc8, 0xfd, 0x37, 0xfd, 0x40, 0x88, 0x9b, 0xc5, 0xd6, 0x5e, 0x6a,
|
||||
0x88, 0x6f, 0xb9, 0x42, 0xcf, 0x6f, 0x2c, 0xe4, 0x26, 0xd8, 0xce, 0x92, 0xdd, 0x69, 0xba, 0x4f,
|
||||
0x9a, 0x91, 0x91, 0x6e, 0x9f, 0xb2, 0x8e, 0x87, 0xb3, 0x93, 0xc5, 0x64, 0xf9, 0xb0, 0xff, 0x09,
|
||||
0xdc, 0x73, 0xb3, 0x80, 0x9e, 0xfd, 0x8a, 0x48, 0x9c, 0xa3, 0xec, 0x45, 0xcf, 0x26, 0x3e, 0x78,
|
||||
0xd5, 0x6e, 0xca, 0x2a, 0xfa, 0x7e, 0x1a, 0xa0, 0x12, 0x2b, 0xae, 0xca, 0x04, 0x4d, 0x99, 0x96,
|
||||
0xa0, 0xdc, 0x1e, 0xa5, 0x5e, 0xe2, 0x5a, 0xd4, 0x57, 0xb7, 0xed, 0xcd, 0xe1, 0xef, 0xf7, 0x60,
|
||||
0xfa, 0xd1, 0x17, 0x78, 0x57, 0xe1, 0xae, 0xe8, 0x86, 0xdc, 0x66, 0xad, 0xb3, 0x3f, 0x9d, 0xb8,
|
||||
0x71, 0xe2, 0xe6, 0x20, 0x6e, 0xd6, 0xd9, 0xc5, 0xc8, 0x85, 0x64, 0xff, 0x02, 0x00, 0x00, 0xff,
|
||||
0xff, 0x5a, 0x88, 0xc9, 0x0b, 0x7e, 0x03, 0x00, 0x00,
|
||||
}
|
||||
+1209
File diff suppressed because it is too large
Load Diff
+97
@@ -0,0 +1,97 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/monitoring/v3/mutation_record.proto
|
||||
|
||||
package monitoring // import "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import timestamp "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
|
||||
|
||||
// Describes a change made to a configuration.
|
||||
type MutationRecord struct {
|
||||
// When the change occurred.
|
||||
MutateTime *timestamp.Timestamp `protobuf:"bytes,1,opt,name=mutate_time,json=mutateTime,proto3" json:"mutate_time,omitempty"`
|
||||
// The email address of the user making the change.
|
||||
MutatedBy string `protobuf:"bytes,2,opt,name=mutated_by,json=mutatedBy,proto3" json:"mutated_by,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *MutationRecord) Reset() { *m = MutationRecord{} }
|
||||
func (m *MutationRecord) String() string { return proto.CompactTextString(m) }
|
||||
func (*MutationRecord) ProtoMessage() {}
|
||||
func (*MutationRecord) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_mutation_record_9017e3771537eac7, []int{0}
|
||||
}
|
||||
func (m *MutationRecord) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MutationRecord.Unmarshal(m, b)
|
||||
}
|
||||
func (m *MutationRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_MutationRecord.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *MutationRecord) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MutationRecord.Merge(dst, src)
|
||||
}
|
||||
func (m *MutationRecord) XXX_Size() int {
|
||||
return xxx_messageInfo_MutationRecord.Size(m)
|
||||
}
|
||||
func (m *MutationRecord) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MutationRecord.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MutationRecord proto.InternalMessageInfo
|
||||
|
||||
func (m *MutationRecord) GetMutateTime() *timestamp.Timestamp {
|
||||
if m != nil {
|
||||
return m.MutateTime
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MutationRecord) GetMutatedBy() string {
|
||||
if m != nil {
|
||||
return m.MutatedBy
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MutationRecord)(nil), "google.monitoring.v3.MutationRecord")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google/monitoring/v3/mutation_record.proto", fileDescriptor_mutation_record_9017e3771537eac7)
|
||||
}
|
||||
|
||||
var fileDescriptor_mutation_record_9017e3771537eac7 = []byte{
|
||||
// 251 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4a, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0xcf, 0xcd, 0xcf, 0xcb, 0x2c, 0xc9, 0x2f, 0xca, 0xcc, 0x4b, 0xd7, 0x2f, 0x33,
|
||||
0xd6, 0xcf, 0x2d, 0x2d, 0x49, 0x2c, 0xc9, 0xcc, 0xcf, 0x8b, 0x2f, 0x4a, 0x4d, 0xce, 0x2f, 0x4a,
|
||||
0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x81, 0xa8, 0xd5, 0x43, 0xa8, 0xd5, 0x2b, 0x33,
|
||||
0x96, 0x92, 0x87, 0x9a, 0x00, 0x56, 0x93, 0x54, 0x9a, 0xa6, 0x5f, 0x92, 0x99, 0x9b, 0x5a, 0x5c,
|
||||
0x92, 0x98, 0x5b, 0x00, 0xd1, 0xa6, 0x94, 0xc3, 0xc5, 0xe7, 0x0b, 0x35, 0x2f, 0x08, 0x6c, 0x9c,
|
||||
0x90, 0x35, 0x17, 0x37, 0xd8, 0x86, 0xd4, 0x78, 0x90, 0x5a, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x6e,
|
||||
0x23, 0x29, 0x3d, 0xa8, 0xf1, 0x30, 0x83, 0xf4, 0x42, 0x60, 0x06, 0x05, 0x71, 0x41, 0x94, 0x83,
|
||||
0x04, 0x84, 0x64, 0xb9, 0xa0, 0xbc, 0x94, 0xf8, 0xa4, 0x4a, 0x09, 0x26, 0x05, 0x46, 0x0d, 0xce,
|
||||
0x20, 0x4e, 0xa8, 0x88, 0x53, 0xa5, 0xd3, 0x6a, 0x46, 0x2e, 0x89, 0xe4, 0xfc, 0x5c, 0x3d, 0x6c,
|
||||
0x6e, 0x75, 0x12, 0x46, 0x75, 0x48, 0x00, 0xc8, 0xa6, 0x00, 0xc6, 0x28, 0x3b, 0xa8, 0xe2, 0xf4,
|
||||
0xfc, 0x9c, 0xc4, 0xbc, 0x74, 0xbd, 0xfc, 0xa2, 0x74, 0xfd, 0xf4, 0xd4, 0x3c, 0xb0, 0x3b, 0xf4,
|
||||
0x21, 0x52, 0x89, 0x05, 0x99, 0xc5, 0xa8, 0x61, 0x64, 0x8d, 0xe0, 0xad, 0x62, 0x92, 0x72, 0x87,
|
||||
0x18, 0xe0, 0x9c, 0x93, 0x5f, 0x9a, 0xa2, 0xe7, 0x8b, 0xb0, 0x33, 0xcc, 0xf8, 0x14, 0x4c, 0x32,
|
||||
0x06, 0x2c, 0x19, 0x83, 0x90, 0x8c, 0x09, 0x33, 0x4e, 0x62, 0x03, 0x5b, 0x62, 0x0c, 0x08, 0x00,
|
||||
0x00, 0xff, 0xff, 0x95, 0xa7, 0xf3, 0xbd, 0x87, 0x01, 0x00, 0x00,
|
||||
}
|
||||
+368
@@ -0,0 +1,368 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/monitoring/v3/notification.proto
|
||||
|
||||
package monitoring // import "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import wrappers "github.com/golang/protobuf/ptypes/wrappers"
|
||||
import _ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
import label "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
|
||||
|
||||
// Indicates whether the channel has been verified or not. It is illegal
|
||||
// to specify this field in a
|
||||
// [`CreateNotificationChannel`][google.monitoring.v3.NotificationChannelService.CreateNotificationChannel]
|
||||
// or an
|
||||
// [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel]
|
||||
// operation.
|
||||
type NotificationChannel_VerificationStatus int32
|
||||
|
||||
const (
|
||||
// Sentinel value used to indicate that the state is unknown, omitted, or
|
||||
// is not applicable (as in the case of channels that neither support
|
||||
// nor require verification in order to function).
|
||||
NotificationChannel_VERIFICATION_STATUS_UNSPECIFIED NotificationChannel_VerificationStatus = 0
|
||||
// The channel has yet to be verified and requires verification to function.
|
||||
// Note that this state also applies to the case where the verification
|
||||
// process has been initiated by sending a verification code but where
|
||||
// the verification code has not been submitted to complete the process.
|
||||
NotificationChannel_UNVERIFIED NotificationChannel_VerificationStatus = 1
|
||||
// It has been proven that notifications can be received on this
|
||||
// notification channel and that someone on the project has access
|
||||
// to messages that are delivered to that channel.
|
||||
NotificationChannel_VERIFIED NotificationChannel_VerificationStatus = 2
|
||||
)
|
||||
|
||||
var NotificationChannel_VerificationStatus_name = map[int32]string{
|
||||
0: "VERIFICATION_STATUS_UNSPECIFIED",
|
||||
1: "UNVERIFIED",
|
||||
2: "VERIFIED",
|
||||
}
|
||||
var NotificationChannel_VerificationStatus_value = map[string]int32{
|
||||
"VERIFICATION_STATUS_UNSPECIFIED": 0,
|
||||
"UNVERIFIED": 1,
|
||||
"VERIFIED": 2,
|
||||
}
|
||||
|
||||
func (x NotificationChannel_VerificationStatus) String() string {
|
||||
return proto.EnumName(NotificationChannel_VerificationStatus_name, int32(x))
|
||||
}
|
||||
func (NotificationChannel_VerificationStatus) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_notification_edf6bf9ac9e92803, []int{1, 0}
|
||||
}
|
||||
|
||||
// A description of a notification channel. The descriptor includes
|
||||
// the properties of the channel and the set of labels or fields that
|
||||
// must be specified to configure channels of a given type.
|
||||
type NotificationChannelDescriptor struct {
|
||||
// The full REST resource name for this descriptor. The syntax is:
|
||||
//
|
||||
// projects/[PROJECT_ID]/notificationChannelDescriptors/[TYPE]
|
||||
//
|
||||
// In the above, `[TYPE]` is the value of the `type` field.
|
||||
Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// The type of notification channel, such as "email", "sms", etc.
|
||||
// Notification channel types are globally unique.
|
||||
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
|
||||
// A human-readable name for the notification channel type. This
|
||||
// form of the name is suitable for a user interface.
|
||||
DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
|
||||
// A human-readable description of the notification channel
|
||||
// type. The description may include a description of the properties
|
||||
// of the channel and pointers to external documentation.
|
||||
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
|
||||
// The set of labels that must be defined to identify a particular
|
||||
// channel of the corresponding type. Each label includes a
|
||||
// description for how that field should be populated.
|
||||
Labels []*label.LabelDescriptor `protobuf:"bytes,4,rep,name=labels,proto3" json:"labels,omitempty"`
|
||||
// The tiers that support this notification channel; the project service tier
|
||||
// must be one of the supported_tiers.
|
||||
SupportedTiers []ServiceTier `protobuf:"varint,5,rep,packed,name=supported_tiers,json=supportedTiers,proto3,enum=google.monitoring.v3.ServiceTier" json:"supported_tiers,omitempty"` // Deprecated: Do not use.
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *NotificationChannelDescriptor) Reset() { *m = NotificationChannelDescriptor{} }
|
||||
func (m *NotificationChannelDescriptor) String() string { return proto.CompactTextString(m) }
|
||||
func (*NotificationChannelDescriptor) ProtoMessage() {}
|
||||
func (*NotificationChannelDescriptor) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_notification_edf6bf9ac9e92803, []int{0}
|
||||
}
|
||||
func (m *NotificationChannelDescriptor) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_NotificationChannelDescriptor.Unmarshal(m, b)
|
||||
}
|
||||
func (m *NotificationChannelDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_NotificationChannelDescriptor.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *NotificationChannelDescriptor) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_NotificationChannelDescriptor.Merge(dst, src)
|
||||
}
|
||||
func (m *NotificationChannelDescriptor) XXX_Size() int {
|
||||
return xxx_messageInfo_NotificationChannelDescriptor.Size(m)
|
||||
}
|
||||
func (m *NotificationChannelDescriptor) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_NotificationChannelDescriptor.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_NotificationChannelDescriptor proto.InternalMessageInfo
|
||||
|
||||
func (m *NotificationChannelDescriptor) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *NotificationChannelDescriptor) GetType() string {
|
||||
if m != nil {
|
||||
return m.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *NotificationChannelDescriptor) GetDisplayName() string {
|
||||
if m != nil {
|
||||
return m.DisplayName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *NotificationChannelDescriptor) GetDescription() string {
|
||||
if m != nil {
|
||||
return m.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *NotificationChannelDescriptor) GetLabels() []*label.LabelDescriptor {
|
||||
if m != nil {
|
||||
return m.Labels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated: Do not use.
|
||||
func (m *NotificationChannelDescriptor) GetSupportedTiers() []ServiceTier {
|
||||
if m != nil {
|
||||
return m.SupportedTiers
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A `NotificationChannel` is a medium through which an alert is
|
||||
// delivered when a policy violation is detected. Examples of channels
|
||||
// include email, SMS, and third-party messaging applications. Fields
|
||||
// containing sensitive information like authentication tokens or
|
||||
// contact info are only partially populated on retrieval.
|
||||
type NotificationChannel struct {
|
||||
// The type of the notification channel. This field matches the
|
||||
// value of the [NotificationChannelDescriptor.type][google.monitoring.v3.NotificationChannelDescriptor.type] field.
|
||||
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
|
||||
// The full REST resource name for this channel. The syntax is:
|
||||
//
|
||||
// projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
|
||||
//
|
||||
// The `[CHANNEL_ID]` is automatically assigned by the server on creation.
|
||||
Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// An optional human-readable name for this notification channel. It is
|
||||
// recommended that you specify a non-empty and unique name in order to
|
||||
// make it easier to identify the channels in your project, though this is
|
||||
// not enforced. The display name is limited to 512 Unicode characters.
|
||||
DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
|
||||
// An optional human-readable description of this notification channel. This
|
||||
// description may provide additional details, beyond the display
|
||||
// name, for the channel. This may not exceeed 1024 Unicode characters.
|
||||
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
|
||||
// Configuration fields that define the channel and its behavior. The
|
||||
// permissible and required labels are specified in the
|
||||
// [NotificationChannelDescriptor.labels][google.monitoring.v3.NotificationChannelDescriptor.labels] of the
|
||||
// `NotificationChannelDescriptor` corresponding to the `type` field.
|
||||
Labels map[string]string `protobuf:"bytes,5,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
// User-supplied key/value data that does not need to conform to
|
||||
// the corresponding `NotificationChannelDescriptor`'s schema, unlike
|
||||
// the `labels` field. This field is intended to be used for organizing
|
||||
// and identifying the `NotificationChannel` objects.
|
||||
//
|
||||
// The field can contain up to 64 entries. Each key and value is limited to
|
||||
// 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
|
||||
// values can contain only lowercase letters, numerals, underscores, and
|
||||
// dashes. Keys must begin with a letter.
|
||||
UserLabels map[string]string `protobuf:"bytes,8,rep,name=user_labels,json=userLabels,proto3" json:"user_labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
// Indicates whether this channel has been verified or not. On a
|
||||
// [`ListNotificationChannels`][google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
|
||||
// or
|
||||
// [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel]
|
||||
// operation, this field is expected to be populated.
|
||||
//
|
||||
// If the value is `UNVERIFIED`, then it indicates that the channel is
|
||||
// non-functioning (it both requires verification and lacks verification);
|
||||
// otherwise, it is assumed that the channel works.
|
||||
//
|
||||
// If the channel is neither `VERIFIED` nor `UNVERIFIED`, it implies that
|
||||
// the channel is of a type that does not require verification or that
|
||||
// this specific channel has been exempted from verification because it was
|
||||
// created prior to verification being required for channels of this type.
|
||||
//
|
||||
// This field cannot be modified using a standard
|
||||
// [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel]
|
||||
// operation. To change the value of this field, you must call
|
||||
// [`VerifyNotificationChannel`][google.monitoring.v3.NotificationChannelService.VerifyNotificationChannel].
|
||||
VerificationStatus NotificationChannel_VerificationStatus `protobuf:"varint,9,opt,name=verification_status,json=verificationStatus,proto3,enum=google.monitoring.v3.NotificationChannel_VerificationStatus" json:"verification_status,omitempty"`
|
||||
// Whether notifications are forwarded to the described channel. This makes
|
||||
// it possible to disable delivery of notifications to a particular channel
|
||||
// without removing the channel from all alerting policies that reference
|
||||
// the channel. This is a more convenient approach when the change is
|
||||
// temporary and you want to receive notifications from the same set
|
||||
// of alerting policies on the channel at some point in the future.
|
||||
Enabled *wrappers.BoolValue `protobuf:"bytes,11,opt,name=enabled,proto3" json:"enabled,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *NotificationChannel) Reset() { *m = NotificationChannel{} }
|
||||
func (m *NotificationChannel) String() string { return proto.CompactTextString(m) }
|
||||
func (*NotificationChannel) ProtoMessage() {}
|
||||
func (*NotificationChannel) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_notification_edf6bf9ac9e92803, []int{1}
|
||||
}
|
||||
func (m *NotificationChannel) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_NotificationChannel.Unmarshal(m, b)
|
||||
}
|
||||
func (m *NotificationChannel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_NotificationChannel.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *NotificationChannel) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_NotificationChannel.Merge(dst, src)
|
||||
}
|
||||
func (m *NotificationChannel) XXX_Size() int {
|
||||
return xxx_messageInfo_NotificationChannel.Size(m)
|
||||
}
|
||||
func (m *NotificationChannel) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_NotificationChannel.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_NotificationChannel proto.InternalMessageInfo
|
||||
|
||||
func (m *NotificationChannel) GetType() string {
|
||||
if m != nil {
|
||||
return m.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *NotificationChannel) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *NotificationChannel) GetDisplayName() string {
|
||||
if m != nil {
|
||||
return m.DisplayName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *NotificationChannel) GetDescription() string {
|
||||
if m != nil {
|
||||
return m.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *NotificationChannel) GetLabels() map[string]string {
|
||||
if m != nil {
|
||||
return m.Labels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *NotificationChannel) GetUserLabels() map[string]string {
|
||||
if m != nil {
|
||||
return m.UserLabels
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *NotificationChannel) GetVerificationStatus() NotificationChannel_VerificationStatus {
|
||||
if m != nil {
|
||||
return m.VerificationStatus
|
||||
}
|
||||
return NotificationChannel_VERIFICATION_STATUS_UNSPECIFIED
|
||||
}
|
||||
|
||||
func (m *NotificationChannel) GetEnabled() *wrappers.BoolValue {
|
||||
if m != nil {
|
||||
return m.Enabled
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*NotificationChannelDescriptor)(nil), "google.monitoring.v3.NotificationChannelDescriptor")
|
||||
proto.RegisterType((*NotificationChannel)(nil), "google.monitoring.v3.NotificationChannel")
|
||||
proto.RegisterMapType((map[string]string)(nil), "google.monitoring.v3.NotificationChannel.LabelsEntry")
|
||||
proto.RegisterMapType((map[string]string)(nil), "google.monitoring.v3.NotificationChannel.UserLabelsEntry")
|
||||
proto.RegisterEnum("google.monitoring.v3.NotificationChannel_VerificationStatus", NotificationChannel_VerificationStatus_name, NotificationChannel_VerificationStatus_value)
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google/monitoring/v3/notification.proto", fileDescriptor_notification_edf6bf9ac9e92803)
|
||||
}
|
||||
|
||||
var fileDescriptor_notification_edf6bf9ac9e92803 = []byte{
|
||||
// 602 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x6d, 0x6b, 0xdb, 0x3c,
|
||||
0x14, 0x7d, 0x9c, 0x34, 0x7d, 0x5a, 0xb9, 0xa4, 0x9d, 0x5a, 0x86, 0xf1, 0xde, 0xd2, 0xee, 0xc3,
|
||||
0xf2, 0xc9, 0x86, 0x64, 0x83, 0x75, 0x6f, 0xd0, 0xa4, 0xe9, 0x08, 0xac, 0x59, 0xc9, 0xdb, 0xa0,
|
||||
0x14, 0x82, 0x92, 0xa8, 0x9e, 0x98, 0x2d, 0x19, 0x49, 0xf6, 0xc8, 0xcf, 0xd8, 0x8f, 0xd8, 0x87,
|
||||
0xed, 0xa7, 0xec, 0x57, 0x0d, 0xcb, 0x8a, 0xed, 0xb5, 0x86, 0x75, 0xdf, 0x74, 0xcf, 0x3d, 0xe7,
|
||||
0xdc, 0x7b, 0x4f, 0x4c, 0xc0, 0x33, 0x8f, 0x31, 0xcf, 0xc7, 0x6e, 0xc0, 0x28, 0x91, 0x8c, 0x13,
|
||||
0xea, 0xb9, 0x71, 0xdb, 0xa5, 0x4c, 0x92, 0x6b, 0xb2, 0x40, 0x92, 0x30, 0xea, 0x84, 0x9c, 0x49,
|
||||
0x06, 0x0f, 0x52, 0xa2, 0x93, 0x13, 0x9d, 0xb8, 0x6d, 0x3f, 0xd4, 0x72, 0x14, 0x12, 0x17, 0x51,
|
||||
0xca, 0xa4, 0x92, 0x88, 0x54, 0x63, 0xdf, 0x2f, 0x74, 0x7d, 0x34, 0xc7, 0xbe, 0xc6, 0x0f, 0x4b,
|
||||
0x87, 0x2e, 0x58, 0x10, 0xac, 0xc7, 0xd9, 0x8f, 0x35, 0x45, 0x55, 0xf3, 0xe8, 0xda, 0xfd, 0xca,
|
||||
0x51, 0x18, 0x62, 0xae, 0xad, 0x8f, 0xbe, 0x55, 0xc0, 0xa3, 0x41, 0x61, 0xcb, 0xee, 0x67, 0x44,
|
||||
0x29, 0xf6, 0x4f, 0xb1, 0x58, 0x70, 0x12, 0x4a, 0xc6, 0x21, 0x04, 0x1b, 0x14, 0x05, 0xd8, 0xda,
|
||||
0x6c, 0x18, 0xcd, 0xed, 0xa1, 0x7a, 0x27, 0x98, 0x5c, 0x85, 0xd8, 0x32, 0x52, 0x2c, 0x79, 0xc3,
|
||||
0x43, 0xb0, 0xb3, 0x24, 0x22, 0xf4, 0xd1, 0x6a, 0xa6, 0xf8, 0x15, 0xd5, 0x33, 0x35, 0x36, 0x48,
|
||||
0x64, 0x0d, 0x60, 0x2e, 0xb5, 0x31, 0x61, 0xd4, 0xaa, 0x6a, 0x46, 0x0e, 0xc1, 0x36, 0xd8, 0x54,
|
||||
0x07, 0x0a, 0x6b, 0xa3, 0x51, 0x6d, 0x9a, 0xad, 0x07, 0x8e, 0x8e, 0x0b, 0x85, 0xc4, 0xf9, 0x90,
|
||||
0x74, 0xf2, 0xcd, 0x86, 0x9a, 0x0a, 0x07, 0x60, 0x57, 0x44, 0x61, 0xc8, 0xb8, 0xc4, 0xcb, 0x99,
|
||||
0x24, 0x98, 0x0b, 0xab, 0xd6, 0xa8, 0x36, 0xeb, 0xad, 0x43, 0xa7, 0x2c, 0x6c, 0x67, 0x84, 0x79,
|
||||
0x4c, 0x16, 0x78, 0x4c, 0x30, 0xef, 0x54, 0x2c, 0x63, 0x58, 0xcf, 0xd4, 0x09, 0x24, 0x8e, 0xbe,
|
||||
0xd7, 0xc0, 0x7e, 0x49, 0x26, 0xa5, 0x57, 0x97, 0xa5, 0x73, 0x33, 0x89, 0xea, 0x5f, 0x93, 0xd8,
|
||||
0xb8, 0x9d, 0xc4, 0x79, 0x96, 0x44, 0x4d, 0x25, 0xf1, 0xa2, 0xfc, 0x96, 0x92, 0x3d, 0xd3, 0x9c,
|
||||
0x44, 0x8f, 0x4a, 0xbe, 0xca, 0x32, 0xba, 0x04, 0x66, 0x24, 0x30, 0x9f, 0x69, 0xcf, 0x2d, 0xe5,
|
||||
0x79, 0x7c, 0x77, 0xcf, 0x89, 0xc0, 0xbc, 0xe8, 0x0b, 0xa2, 0x0c, 0x80, 0x01, 0xd8, 0x8f, 0x31,
|
||||
0xcf, 0x24, 0x33, 0x21, 0x91, 0x8c, 0x84, 0xb5, 0xdd, 0x30, 0x9a, 0xf5, 0xd6, 0x9b, 0xbb, 0xcf,
|
||||
0x98, 0x16, 0x4c, 0x46, 0xca, 0x63, 0x08, 0xe3, 0x5b, 0x18, 0x7c, 0x0e, 0xfe, 0xc7, 0x14, 0xcd,
|
||||
0x7d, 0xbc, 0xb4, 0xcc, 0x86, 0xd1, 0x34, 0x5b, 0xf6, 0x7a, 0xc4, 0xfa, 0x23, 0x77, 0x3a, 0x8c,
|
||||
0xf9, 0x53, 0xe4, 0x47, 0x78, 0xb8, 0xa6, 0xda, 0xc7, 0xc0, 0x2c, 0xec, 0x0f, 0xf7, 0x40, 0xf5,
|
||||
0x0b, 0x5e, 0xe9, 0x9f, 0x32, 0x79, 0xc2, 0x03, 0x50, 0x8b, 0x13, 0x89, 0xfe, 0x70, 0xd3, 0xe2,
|
||||
0x55, 0xe5, 0xa5, 0x61, 0xbf, 0x05, 0xbb, 0x37, 0xce, 0xff, 0x17, 0xf9, 0xd1, 0x27, 0x00, 0x6f,
|
||||
0x5f, 0x06, 0x9f, 0x82, 0x27, 0xd3, 0xde, 0xb0, 0x7f, 0xd6, 0xef, 0x9e, 0x8c, 0xfb, 0x1f, 0x07,
|
||||
0xb3, 0xd1, 0xf8, 0x64, 0x3c, 0x19, 0xcd, 0x26, 0x83, 0xd1, 0x45, 0xaf, 0xdb, 0x3f, 0xeb, 0xf7,
|
||||
0x4e, 0xf7, 0xfe, 0x83, 0x75, 0x00, 0x26, 0x83, 0x94, 0xd6, 0x3b, 0xdd, 0x33, 0xe0, 0x0e, 0xd8,
|
||||
0xca, 0xaa, 0x4a, 0xe7, 0x87, 0x01, 0xac, 0x05, 0x0b, 0x4a, 0x03, 0xee, 0xdc, 0x2b, 0x26, 0x7c,
|
||||
0x91, 0x04, 0x73, 0x61, 0x5c, 0xbe, 0xd3, 0x54, 0x8f, 0xf9, 0x88, 0x7a, 0x0e, 0xe3, 0x9e, 0xeb,
|
||||
0x61, 0xaa, 0x62, 0x73, 0xd3, 0x16, 0x0a, 0x89, 0xf8, 0xf3, 0xff, 0xe4, 0x75, 0x5e, 0xfd, 0xac,
|
||||
0xd8, 0xef, 0x53, 0x83, 0xae, 0xcf, 0xa2, 0xa5, 0x73, 0x9e, 0x4f, 0x9c, 0xb6, 0x7f, 0xad, 0x9b,
|
||||
0x57, 0xaa, 0x79, 0x95, 0x37, 0xaf, 0xa6, 0xed, 0xf9, 0xa6, 0x1a, 0xd2, 0xfe, 0x1d, 0x00, 0x00,
|
||||
0xff, 0xff, 0xf7, 0x1b, 0x09, 0x21, 0x28, 0x05, 0x00, 0x00,
|
||||
}
|
||||
Generated
Vendored
+1307
File diff suppressed because it is too large
Load Diff
+96
@@ -0,0 +1,96 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/monitoring/v3/span_context.proto
|
||||
|
||||
package monitoring // import "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
|
||||
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
|
||||
|
||||
// The context of a span, attached to google.api.Distribution.Exemplars
|
||||
// in google.api.Distribution values during aggregation.
|
||||
//
|
||||
// It contains the name of a span with format:
|
||||
// projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]
|
||||
type SpanContext struct {
|
||||
// The resource name of the span in the following format:
|
||||
//
|
||||
// projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]
|
||||
//
|
||||
// [TRACE_ID] is a unique identifier for a trace within a project;
|
||||
// it is a 32-character hexadecimal encoding of a 16-byte array.
|
||||
//
|
||||
// [SPAN_ID] is a unique identifier for a span within a trace; it
|
||||
// is a 16-character hexadecimal encoding of an 8-byte array.
|
||||
SpanName string `protobuf:"bytes,1,opt,name=span_name,json=spanName,proto3" json:"span_name,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *SpanContext) Reset() { *m = SpanContext{} }
|
||||
func (m *SpanContext) String() string { return proto.CompactTextString(m) }
|
||||
func (*SpanContext) ProtoMessage() {}
|
||||
func (*SpanContext) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_span_context_3190ff95558fbb1a, []int{0}
|
||||
}
|
||||
func (m *SpanContext) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_SpanContext.Unmarshal(m, b)
|
||||
}
|
||||
func (m *SpanContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_SpanContext.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *SpanContext) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_SpanContext.Merge(dst, src)
|
||||
}
|
||||
func (m *SpanContext) XXX_Size() int {
|
||||
return xxx_messageInfo_SpanContext.Size(m)
|
||||
}
|
||||
func (m *SpanContext) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_SpanContext.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_SpanContext proto.InternalMessageInfo
|
||||
|
||||
func (m *SpanContext) GetSpanName() string {
|
||||
if m != nil {
|
||||
return m.SpanName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*SpanContext)(nil), "google.monitoring.v3.SpanContext")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google/monitoring/v3/span_context.proto", fileDescriptor_span_context_3190ff95558fbb1a)
|
||||
}
|
||||
|
||||
var fileDescriptor_span_context_3190ff95558fbb1a = []byte{
|
||||
// 197 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4f, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0xcf, 0xcd, 0xcf, 0xcb, 0x2c, 0xc9, 0x2f, 0xca, 0xcc, 0x4b, 0xd7, 0x2f, 0x33,
|
||||
0xd6, 0x2f, 0x2e, 0x48, 0xcc, 0x8b, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xad, 0x28, 0xd1, 0x2b, 0x28,
|
||||
0xca, 0x2f, 0xc9, 0x17, 0x12, 0x81, 0x28, 0xd4, 0x43, 0x28, 0xd4, 0x2b, 0x33, 0x56, 0xd2, 0xe2,
|
||||
0xe2, 0x0e, 0x2e, 0x48, 0xcc, 0x73, 0x86, 0x28, 0x15, 0x92, 0xe6, 0xe2, 0x04, 0x6b, 0xcd, 0x4b,
|
||||
0xcc, 0x4d, 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0xe2, 0x00, 0x09, 0xf8, 0x25, 0xe6, 0xa6,
|
||||
0x3a, 0xad, 0x60, 0xe4, 0x92, 0x48, 0xce, 0xcf, 0xd5, 0xc3, 0x66, 0x90, 0x93, 0x00, 0x92, 0x31,
|
||||
0x01, 0x20, 0x0b, 0x03, 0x18, 0xa3, 0xec, 0xa0, 0x2a, 0xd3, 0xf3, 0x73, 0x12, 0xf3, 0xd2, 0xf5,
|
||||
0xf2, 0x8b, 0xd2, 0xf5, 0xd3, 0x53, 0xf3, 0xc0, 0xce, 0xd1, 0x87, 0x48, 0x25, 0x16, 0x64, 0x16,
|
||||
0xa3, 0x3a, 0xdd, 0x1a, 0xc1, 0x5b, 0xc5, 0x24, 0xe5, 0x0e, 0x31, 0xc0, 0x39, 0x27, 0xbf, 0x34,
|
||||
0x45, 0xcf, 0x17, 0x61, 0x61, 0x98, 0xf1, 0x29, 0x98, 0x64, 0x0c, 0x58, 0x32, 0x06, 0x21, 0x19,
|
||||
0x13, 0x66, 0x9c, 0xc4, 0x06, 0xb6, 0xc4, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xbd, 0x19, 0x01,
|
||||
0xcb, 0x1e, 0x01, 0x00, 0x00,
|
||||
}
|
||||
+957
@@ -0,0 +1,957 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/monitoring/v3/uptime.proto
|
||||
|
||||
package monitoring // import "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import duration "github.com/golang/protobuf/ptypes/duration"
|
||||
import monitoredres "google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
|
||||
// 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 regions from which an uptime check can be run.
|
||||
type UptimeCheckRegion int32
|
||||
|
||||
const (
|
||||
// Default value if no region is specified. Will result in uptime checks
|
||||
// running from all regions.
|
||||
UptimeCheckRegion_REGION_UNSPECIFIED UptimeCheckRegion = 0
|
||||
// Allows checks to run from locations within the United States of America.
|
||||
UptimeCheckRegion_USA UptimeCheckRegion = 1
|
||||
// Allows checks to run from locations within the continent of Europe.
|
||||
UptimeCheckRegion_EUROPE UptimeCheckRegion = 2
|
||||
// Allows checks to run from locations within the continent of South
|
||||
// America.
|
||||
UptimeCheckRegion_SOUTH_AMERICA UptimeCheckRegion = 3
|
||||
// Allows checks to run from locations within the Asia Pacific area (ex:
|
||||
// Singapore).
|
||||
UptimeCheckRegion_ASIA_PACIFIC UptimeCheckRegion = 4
|
||||
)
|
||||
|
||||
var UptimeCheckRegion_name = map[int32]string{
|
||||
0: "REGION_UNSPECIFIED",
|
||||
1: "USA",
|
||||
2: "EUROPE",
|
||||
3: "SOUTH_AMERICA",
|
||||
4: "ASIA_PACIFIC",
|
||||
}
|
||||
var UptimeCheckRegion_value = map[string]int32{
|
||||
"REGION_UNSPECIFIED": 0,
|
||||
"USA": 1,
|
||||
"EUROPE": 2,
|
||||
"SOUTH_AMERICA": 3,
|
||||
"ASIA_PACIFIC": 4,
|
||||
}
|
||||
|
||||
func (x UptimeCheckRegion) String() string {
|
||||
return proto.EnumName(UptimeCheckRegion_name, int32(x))
|
||||
}
|
||||
func (UptimeCheckRegion) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_0cd9344e0988a0e6, []int{0}
|
||||
}
|
||||
|
||||
// The supported resource types that can be used as values of
|
||||
// `group_resource.resource_type`.
|
||||
// `INSTANCE` includes `gce_instance` and `aws_ec2_instance` resource types.
|
||||
// The resource types `gae_app` and `uptime_url` are not valid here because
|
||||
// group checks on App Engine modules and URLs are not allowed.
|
||||
type GroupResourceType int32
|
||||
|
||||
const (
|
||||
// Default value (not valid).
|
||||
GroupResourceType_RESOURCE_TYPE_UNSPECIFIED GroupResourceType = 0
|
||||
// A group of instances from Google Cloud Platform (GCP) or
|
||||
// Amazon Web Services (AWS).
|
||||
GroupResourceType_INSTANCE GroupResourceType = 1
|
||||
// A group of Amazon ELB load balancers.
|
||||
GroupResourceType_AWS_ELB_LOAD_BALANCER GroupResourceType = 2
|
||||
)
|
||||
|
||||
var GroupResourceType_name = map[int32]string{
|
||||
0: "RESOURCE_TYPE_UNSPECIFIED",
|
||||
1: "INSTANCE",
|
||||
2: "AWS_ELB_LOAD_BALANCER",
|
||||
}
|
||||
var GroupResourceType_value = map[string]int32{
|
||||
"RESOURCE_TYPE_UNSPECIFIED": 0,
|
||||
"INSTANCE": 1,
|
||||
"AWS_ELB_LOAD_BALANCER": 2,
|
||||
}
|
||||
|
||||
func (x GroupResourceType) String() string {
|
||||
return proto.EnumName(GroupResourceType_name, int32(x))
|
||||
}
|
||||
func (GroupResourceType) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_0cd9344e0988a0e6, []int{1}
|
||||
}
|
||||
|
||||
// Nimbus InternalCheckers.
|
||||
type InternalChecker struct {
|
||||
// The GCP project ID. Not necessarily the same as the project_id for the
|
||||
// config.
|
||||
ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"`
|
||||
// The internal network to perform this uptime check on.
|
||||
Network string `protobuf:"bytes,2,opt,name=network,proto3" json:"network,omitempty"`
|
||||
// The GCP zone the uptime check should egress from. Only respected for
|
||||
// internal uptime checks, where internal_network is specified.
|
||||
GcpZone string `protobuf:"bytes,3,opt,name=gcp_zone,json=gcpZone,proto3" json:"gcp_zone,omitempty"`
|
||||
// The checker ID.
|
||||
CheckerId string `protobuf:"bytes,4,opt,name=checker_id,json=checkerId,proto3" json:"checker_id,omitempty"`
|
||||
// The checker's human-readable name.
|
||||
DisplayName string `protobuf:"bytes,5,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *InternalChecker) Reset() { *m = InternalChecker{} }
|
||||
func (m *InternalChecker) String() string { return proto.CompactTextString(m) }
|
||||
func (*InternalChecker) ProtoMessage() {}
|
||||
func (*InternalChecker) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_0cd9344e0988a0e6, []int{0}
|
||||
}
|
||||
func (m *InternalChecker) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_InternalChecker.Unmarshal(m, b)
|
||||
}
|
||||
func (m *InternalChecker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_InternalChecker.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *InternalChecker) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_InternalChecker.Merge(dst, src)
|
||||
}
|
||||
func (m *InternalChecker) XXX_Size() int {
|
||||
return xxx_messageInfo_InternalChecker.Size(m)
|
||||
}
|
||||
func (m *InternalChecker) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_InternalChecker.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_InternalChecker proto.InternalMessageInfo
|
||||
|
||||
func (m *InternalChecker) GetProjectId() string {
|
||||
if m != nil {
|
||||
return m.ProjectId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *InternalChecker) GetNetwork() string {
|
||||
if m != nil {
|
||||
return m.Network
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *InternalChecker) GetGcpZone() string {
|
||||
if m != nil {
|
||||
return m.GcpZone
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *InternalChecker) GetCheckerId() string {
|
||||
if m != nil {
|
||||
return m.CheckerId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *InternalChecker) GetDisplayName() string {
|
||||
if m != nil {
|
||||
return m.DisplayName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// This message configures which resources and services to monitor for
|
||||
// availability.
|
||||
type UptimeCheckConfig struct {
|
||||
// A unique resource name for this UptimeCheckConfig. The format is:
|
||||
//
|
||||
//
|
||||
// `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`.
|
||||
//
|
||||
// This field should be omitted when creating the uptime check configuration;
|
||||
// on create, the resource name is assigned by the server and included in the
|
||||
// response.
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// A human-friendly name for the uptime check configuration. The display name
|
||||
// should be unique within a Stackdriver Account in order to make it easier
|
||||
// to identify; however, uniqueness is not enforced. Required.
|
||||
DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
|
||||
// The resource the check is checking. Required.
|
||||
//
|
||||
// Types that are valid to be assigned to Resource:
|
||||
// *UptimeCheckConfig_MonitoredResource
|
||||
// *UptimeCheckConfig_ResourceGroup_
|
||||
Resource isUptimeCheckConfig_Resource `protobuf_oneof:"resource"`
|
||||
// The type of uptime check request.
|
||||
//
|
||||
// Types that are valid to be assigned to CheckRequestType:
|
||||
// *UptimeCheckConfig_HttpCheck_
|
||||
// *UptimeCheckConfig_TcpCheck_
|
||||
CheckRequestType isUptimeCheckConfig_CheckRequestType `protobuf_oneof:"check_request_type"`
|
||||
// How often, in seconds, the uptime check is performed.
|
||||
// Currently, the only supported values are `60s` (1 minute), `300s`
|
||||
// (5 minutes), `600s` (10 minutes), and `900s` (15 minutes). Optional,
|
||||
// defaults to `300s`.
|
||||
Period *duration.Duration `protobuf:"bytes,7,opt,name=period,proto3" json:"period,omitempty"`
|
||||
// The maximum amount of time to wait for the request to complete (must be
|
||||
// between 1 and 60 seconds). Required.
|
||||
Timeout *duration.Duration `protobuf:"bytes,8,opt,name=timeout,proto3" json:"timeout,omitempty"`
|
||||
// The expected content on the page the check is run against.
|
||||
// Currently, only the first entry in the list is supported, and other entries
|
||||
// will be ignored. The server will look for an exact match of the string in
|
||||
// the page response's content. This field is optional and should only be
|
||||
// specified if a content match is required.
|
||||
ContentMatchers []*UptimeCheckConfig_ContentMatcher `protobuf:"bytes,9,rep,name=content_matchers,json=contentMatchers,proto3" json:"content_matchers,omitempty"`
|
||||
// The list of regions from which the check will be run.
|
||||
// If this field is specified, enough regions to include a minimum of
|
||||
// 3 locations must be provided, or an error message is returned.
|
||||
// Not specifying this field will result in uptime checks running from all
|
||||
// regions.
|
||||
SelectedRegions []UptimeCheckRegion `protobuf:"varint,10,rep,packed,name=selected_regions,json=selectedRegions,proto3,enum=google.monitoring.v3.UptimeCheckRegion" json:"selected_regions,omitempty"`
|
||||
// Denotes whether this is a check that egresses from InternalCheckers.
|
||||
IsInternal bool `protobuf:"varint,15,opt,name=is_internal,json=isInternal,proto3" json:"is_internal,omitempty"`
|
||||
// The internal checkers that this check will egress from. If `is_internal` is
|
||||
// true and this list is empty, the check will egress from all
|
||||
// InternalCheckers configured for the project that owns this CheckConfig.
|
||||
InternalCheckers []*InternalChecker `protobuf:"bytes,14,rep,name=internal_checkers,json=internalCheckers,proto3" json:"internal_checkers,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig) Reset() { *m = UptimeCheckConfig{} }
|
||||
func (m *UptimeCheckConfig) String() string { return proto.CompactTextString(m) }
|
||||
func (*UptimeCheckConfig) ProtoMessage() {}
|
||||
func (*UptimeCheckConfig) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_0cd9344e0988a0e6, []int{1}
|
||||
}
|
||||
func (m *UptimeCheckConfig) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UptimeCheckConfig.Unmarshal(m, b)
|
||||
}
|
||||
func (m *UptimeCheckConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_UptimeCheckConfig.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *UptimeCheckConfig) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_UptimeCheckConfig.Merge(dst, src)
|
||||
}
|
||||
func (m *UptimeCheckConfig) XXX_Size() int {
|
||||
return xxx_messageInfo_UptimeCheckConfig.Size(m)
|
||||
}
|
||||
func (m *UptimeCheckConfig) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_UptimeCheckConfig.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_UptimeCheckConfig proto.InternalMessageInfo
|
||||
|
||||
func (m *UptimeCheckConfig) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig) GetDisplayName() string {
|
||||
if m != nil {
|
||||
return m.DisplayName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type isUptimeCheckConfig_Resource interface {
|
||||
isUptimeCheckConfig_Resource()
|
||||
}
|
||||
|
||||
type UptimeCheckConfig_MonitoredResource struct {
|
||||
MonitoredResource *monitoredres.MonitoredResource `protobuf:"bytes,3,opt,name=monitored_resource,json=monitoredResource,proto3,oneof"`
|
||||
}
|
||||
|
||||
type UptimeCheckConfig_ResourceGroup_ struct {
|
||||
ResourceGroup *UptimeCheckConfig_ResourceGroup `protobuf:"bytes,4,opt,name=resource_group,json=resourceGroup,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*UptimeCheckConfig_MonitoredResource) isUptimeCheckConfig_Resource() {}
|
||||
|
||||
func (*UptimeCheckConfig_ResourceGroup_) isUptimeCheckConfig_Resource() {}
|
||||
|
||||
func (m *UptimeCheckConfig) GetResource() isUptimeCheckConfig_Resource {
|
||||
if m != nil {
|
||||
return m.Resource
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig) GetMonitoredResource() *monitoredres.MonitoredResource {
|
||||
if x, ok := m.GetResource().(*UptimeCheckConfig_MonitoredResource); ok {
|
||||
return x.MonitoredResource
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig) GetResourceGroup() *UptimeCheckConfig_ResourceGroup {
|
||||
if x, ok := m.GetResource().(*UptimeCheckConfig_ResourceGroup_); ok {
|
||||
return x.ResourceGroup
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type isUptimeCheckConfig_CheckRequestType interface {
|
||||
isUptimeCheckConfig_CheckRequestType()
|
||||
}
|
||||
|
||||
type UptimeCheckConfig_HttpCheck_ struct {
|
||||
HttpCheck *UptimeCheckConfig_HttpCheck `protobuf:"bytes,5,opt,name=http_check,json=httpCheck,proto3,oneof"`
|
||||
}
|
||||
|
||||
type UptimeCheckConfig_TcpCheck_ struct {
|
||||
TcpCheck *UptimeCheckConfig_TcpCheck `protobuf:"bytes,6,opt,name=tcp_check,json=tcpCheck,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*UptimeCheckConfig_HttpCheck_) isUptimeCheckConfig_CheckRequestType() {}
|
||||
|
||||
func (*UptimeCheckConfig_TcpCheck_) isUptimeCheckConfig_CheckRequestType() {}
|
||||
|
||||
func (m *UptimeCheckConfig) GetCheckRequestType() isUptimeCheckConfig_CheckRequestType {
|
||||
if m != nil {
|
||||
return m.CheckRequestType
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig) GetHttpCheck() *UptimeCheckConfig_HttpCheck {
|
||||
if x, ok := m.GetCheckRequestType().(*UptimeCheckConfig_HttpCheck_); ok {
|
||||
return x.HttpCheck
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig) GetTcpCheck() *UptimeCheckConfig_TcpCheck {
|
||||
if x, ok := m.GetCheckRequestType().(*UptimeCheckConfig_TcpCheck_); ok {
|
||||
return x.TcpCheck
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig) GetPeriod() *duration.Duration {
|
||||
if m != nil {
|
||||
return m.Period
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig) GetTimeout() *duration.Duration {
|
||||
if m != nil {
|
||||
return m.Timeout
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig) GetContentMatchers() []*UptimeCheckConfig_ContentMatcher {
|
||||
if m != nil {
|
||||
return m.ContentMatchers
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig) GetSelectedRegions() []UptimeCheckRegion {
|
||||
if m != nil {
|
||||
return m.SelectedRegions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig) GetIsInternal() bool {
|
||||
if m != nil {
|
||||
return m.IsInternal
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig) GetInternalCheckers() []*InternalChecker {
|
||||
if m != nil {
|
||||
return m.InternalCheckers
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*UptimeCheckConfig) 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 _UptimeCheckConfig_OneofMarshaler, _UptimeCheckConfig_OneofUnmarshaler, _UptimeCheckConfig_OneofSizer, []interface{}{
|
||||
(*UptimeCheckConfig_MonitoredResource)(nil),
|
||||
(*UptimeCheckConfig_ResourceGroup_)(nil),
|
||||
(*UptimeCheckConfig_HttpCheck_)(nil),
|
||||
(*UptimeCheckConfig_TcpCheck_)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _UptimeCheckConfig_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*UptimeCheckConfig)
|
||||
// resource
|
||||
switch x := m.Resource.(type) {
|
||||
case *UptimeCheckConfig_MonitoredResource:
|
||||
b.EncodeVarint(3<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.MonitoredResource); err != nil {
|
||||
return err
|
||||
}
|
||||
case *UptimeCheckConfig_ResourceGroup_:
|
||||
b.EncodeVarint(4<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.ResourceGroup); err != nil {
|
||||
return err
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("UptimeCheckConfig.Resource has unexpected type %T", x)
|
||||
}
|
||||
// check_request_type
|
||||
switch x := m.CheckRequestType.(type) {
|
||||
case *UptimeCheckConfig_HttpCheck_:
|
||||
b.EncodeVarint(5<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.HttpCheck); err != nil {
|
||||
return err
|
||||
}
|
||||
case *UptimeCheckConfig_TcpCheck_:
|
||||
b.EncodeVarint(6<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.TcpCheck); err != nil {
|
||||
return err
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("UptimeCheckConfig.CheckRequestType has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _UptimeCheckConfig_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*UptimeCheckConfig)
|
||||
switch tag {
|
||||
case 3: // resource.monitored_resource
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(monitoredres.MonitoredResource)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Resource = &UptimeCheckConfig_MonitoredResource{msg}
|
||||
return true, err
|
||||
case 4: // resource.resource_group
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(UptimeCheckConfig_ResourceGroup)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Resource = &UptimeCheckConfig_ResourceGroup_{msg}
|
||||
return true, err
|
||||
case 5: // check_request_type.http_check
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(UptimeCheckConfig_HttpCheck)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.CheckRequestType = &UptimeCheckConfig_HttpCheck_{msg}
|
||||
return true, err
|
||||
case 6: // check_request_type.tcp_check
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(UptimeCheckConfig_TcpCheck)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.CheckRequestType = &UptimeCheckConfig_TcpCheck_{msg}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _UptimeCheckConfig_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*UptimeCheckConfig)
|
||||
// resource
|
||||
switch x := m.Resource.(type) {
|
||||
case *UptimeCheckConfig_MonitoredResource:
|
||||
s := proto.Size(x.MonitoredResource)
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *UptimeCheckConfig_ResourceGroup_:
|
||||
s := proto.Size(x.ResourceGroup)
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
// check_request_type
|
||||
switch x := m.CheckRequestType.(type) {
|
||||
case *UptimeCheckConfig_HttpCheck_:
|
||||
s := proto.Size(x.HttpCheck)
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *UptimeCheckConfig_TcpCheck_:
|
||||
s := proto.Size(x.TcpCheck)
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// The resource submessage for group checks. It can be used instead of a
|
||||
// monitored resource, when multiple resources are being monitored.
|
||||
type UptimeCheckConfig_ResourceGroup struct {
|
||||
// The group of resources being monitored. Should be only the
|
||||
// group_id, not projects/<project_id>/groups/<group_id>.
|
||||
GroupId string `protobuf:"bytes,1,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"`
|
||||
// The resource type of the group members.
|
||||
ResourceType GroupResourceType `protobuf:"varint,2,opt,name=resource_type,json=resourceType,proto3,enum=google.monitoring.v3.GroupResourceType" json:"resource_type,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig_ResourceGroup) Reset() { *m = UptimeCheckConfig_ResourceGroup{} }
|
||||
func (m *UptimeCheckConfig_ResourceGroup) String() string { return proto.CompactTextString(m) }
|
||||
func (*UptimeCheckConfig_ResourceGroup) ProtoMessage() {}
|
||||
func (*UptimeCheckConfig_ResourceGroup) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_0cd9344e0988a0e6, []int{1, 0}
|
||||
}
|
||||
func (m *UptimeCheckConfig_ResourceGroup) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UptimeCheckConfig_ResourceGroup.Unmarshal(m, b)
|
||||
}
|
||||
func (m *UptimeCheckConfig_ResourceGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_UptimeCheckConfig_ResourceGroup.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *UptimeCheckConfig_ResourceGroup) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_UptimeCheckConfig_ResourceGroup.Merge(dst, src)
|
||||
}
|
||||
func (m *UptimeCheckConfig_ResourceGroup) XXX_Size() int {
|
||||
return xxx_messageInfo_UptimeCheckConfig_ResourceGroup.Size(m)
|
||||
}
|
||||
func (m *UptimeCheckConfig_ResourceGroup) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_UptimeCheckConfig_ResourceGroup.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_UptimeCheckConfig_ResourceGroup proto.InternalMessageInfo
|
||||
|
||||
func (m *UptimeCheckConfig_ResourceGroup) GetGroupId() string {
|
||||
if m != nil {
|
||||
return m.GroupId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig_ResourceGroup) GetResourceType() GroupResourceType {
|
||||
if m != nil {
|
||||
return m.ResourceType
|
||||
}
|
||||
return GroupResourceType_RESOURCE_TYPE_UNSPECIFIED
|
||||
}
|
||||
|
||||
// Information involved in an HTTP/HTTPS uptime check request.
|
||||
type UptimeCheckConfig_HttpCheck struct {
|
||||
// If true, use HTTPS instead of HTTP to run the check.
|
||||
UseSsl bool `protobuf:"varint,1,opt,name=use_ssl,json=useSsl,proto3" json:"use_ssl,omitempty"`
|
||||
// The path to the page to run the check against. Will be combined with the
|
||||
// host (specified within the MonitoredResource) and port to construct the
|
||||
// full URL. Optional (defaults to "/").
|
||||
Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
|
||||
// The port to the page to run the check against. Will be combined with host
|
||||
// (specified within the MonitoredResource) and path to construct the full
|
||||
// URL. Optional (defaults to 80 without SSL, or 443 with SSL).
|
||||
Port int32 `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"`
|
||||
// The authentication information. Optional when creating an HTTP check;
|
||||
// defaults to empty.
|
||||
AuthInfo *UptimeCheckConfig_HttpCheck_BasicAuthentication `protobuf:"bytes,4,opt,name=auth_info,json=authInfo,proto3" json:"auth_info,omitempty"`
|
||||
// Boolean specifiying whether to encrypt the header information.
|
||||
// Encryption should be specified for any headers related to authentication
|
||||
// that you do not wish to be seen when retrieving the configuration. The
|
||||
// server will be responsible for encrypting the headers.
|
||||
// On Get/List calls, if mask_headers is set to True then the headers
|
||||
// will be obscured with ******.
|
||||
MaskHeaders bool `protobuf:"varint,5,opt,name=mask_headers,json=maskHeaders,proto3" json:"mask_headers,omitempty"`
|
||||
// The list of headers to send as part of the uptime check request.
|
||||
// If two headers have the same key and different values, they should
|
||||
// be entered as a single header, with the value being a comma-separated
|
||||
// list of all the desired values as described at
|
||||
// https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31).
|
||||
// Entering two separate headers with the same key in a Create call will
|
||||
// cause the first to be overwritten by the second.
|
||||
// The maximum number of headers allowed is 100.
|
||||
Headers map[string]string `protobuf:"bytes,6,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig_HttpCheck) Reset() { *m = UptimeCheckConfig_HttpCheck{} }
|
||||
func (m *UptimeCheckConfig_HttpCheck) String() string { return proto.CompactTextString(m) }
|
||||
func (*UptimeCheckConfig_HttpCheck) ProtoMessage() {}
|
||||
func (*UptimeCheckConfig_HttpCheck) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_0cd9344e0988a0e6, []int{1, 1}
|
||||
}
|
||||
func (m *UptimeCheckConfig_HttpCheck) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UptimeCheckConfig_HttpCheck.Unmarshal(m, b)
|
||||
}
|
||||
func (m *UptimeCheckConfig_HttpCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_UptimeCheckConfig_HttpCheck.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *UptimeCheckConfig_HttpCheck) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_UptimeCheckConfig_HttpCheck.Merge(dst, src)
|
||||
}
|
||||
func (m *UptimeCheckConfig_HttpCheck) XXX_Size() int {
|
||||
return xxx_messageInfo_UptimeCheckConfig_HttpCheck.Size(m)
|
||||
}
|
||||
func (m *UptimeCheckConfig_HttpCheck) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_UptimeCheckConfig_HttpCheck.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_UptimeCheckConfig_HttpCheck proto.InternalMessageInfo
|
||||
|
||||
func (m *UptimeCheckConfig_HttpCheck) GetUseSsl() bool {
|
||||
if m != nil {
|
||||
return m.UseSsl
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig_HttpCheck) GetPath() string {
|
||||
if m != nil {
|
||||
return m.Path
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig_HttpCheck) GetPort() int32 {
|
||||
if m != nil {
|
||||
return m.Port
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig_HttpCheck) GetAuthInfo() *UptimeCheckConfig_HttpCheck_BasicAuthentication {
|
||||
if m != nil {
|
||||
return m.AuthInfo
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig_HttpCheck) GetMaskHeaders() bool {
|
||||
if m != nil {
|
||||
return m.MaskHeaders
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig_HttpCheck) GetHeaders() map[string]string {
|
||||
if m != nil {
|
||||
return m.Headers
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A type of authentication to perform against the specified resource or URL
|
||||
// that uses username and password.
|
||||
// Currently, only Basic authentication is supported in Uptime Monitoring.
|
||||
type UptimeCheckConfig_HttpCheck_BasicAuthentication struct {
|
||||
// The username to authenticate.
|
||||
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
|
||||
// The password to authenticate.
|
||||
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig_HttpCheck_BasicAuthentication) Reset() {
|
||||
*m = UptimeCheckConfig_HttpCheck_BasicAuthentication{}
|
||||
}
|
||||
func (m *UptimeCheckConfig_HttpCheck_BasicAuthentication) String() string {
|
||||
return proto.CompactTextString(m)
|
||||
}
|
||||
func (*UptimeCheckConfig_HttpCheck_BasicAuthentication) ProtoMessage() {}
|
||||
func (*UptimeCheckConfig_HttpCheck_BasicAuthentication) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_0cd9344e0988a0e6, []int{1, 1, 0}
|
||||
}
|
||||
func (m *UptimeCheckConfig_HttpCheck_BasicAuthentication) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UptimeCheckConfig_HttpCheck_BasicAuthentication.Unmarshal(m, b)
|
||||
}
|
||||
func (m *UptimeCheckConfig_HttpCheck_BasicAuthentication) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_UptimeCheckConfig_HttpCheck_BasicAuthentication.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *UptimeCheckConfig_HttpCheck_BasicAuthentication) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_UptimeCheckConfig_HttpCheck_BasicAuthentication.Merge(dst, src)
|
||||
}
|
||||
func (m *UptimeCheckConfig_HttpCheck_BasicAuthentication) XXX_Size() int {
|
||||
return xxx_messageInfo_UptimeCheckConfig_HttpCheck_BasicAuthentication.Size(m)
|
||||
}
|
||||
func (m *UptimeCheckConfig_HttpCheck_BasicAuthentication) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_UptimeCheckConfig_HttpCheck_BasicAuthentication.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_UptimeCheckConfig_HttpCheck_BasicAuthentication proto.InternalMessageInfo
|
||||
|
||||
func (m *UptimeCheckConfig_HttpCheck_BasicAuthentication) GetUsername() string {
|
||||
if m != nil {
|
||||
return m.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig_HttpCheck_BasicAuthentication) GetPassword() string {
|
||||
if m != nil {
|
||||
return m.Password
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Information required for a TCP uptime check request.
|
||||
type UptimeCheckConfig_TcpCheck struct {
|
||||
// The port to the page to run the check against. Will be combined with host
|
||||
// (specified within the MonitoredResource) to construct the full URL.
|
||||
// Required.
|
||||
Port int32 `protobuf:"varint,1,opt,name=port,proto3" json:"port,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig_TcpCheck) Reset() { *m = UptimeCheckConfig_TcpCheck{} }
|
||||
func (m *UptimeCheckConfig_TcpCheck) String() string { return proto.CompactTextString(m) }
|
||||
func (*UptimeCheckConfig_TcpCheck) ProtoMessage() {}
|
||||
func (*UptimeCheckConfig_TcpCheck) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_0cd9344e0988a0e6, []int{1, 2}
|
||||
}
|
||||
func (m *UptimeCheckConfig_TcpCheck) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UptimeCheckConfig_TcpCheck.Unmarshal(m, b)
|
||||
}
|
||||
func (m *UptimeCheckConfig_TcpCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_UptimeCheckConfig_TcpCheck.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *UptimeCheckConfig_TcpCheck) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_UptimeCheckConfig_TcpCheck.Merge(dst, src)
|
||||
}
|
||||
func (m *UptimeCheckConfig_TcpCheck) XXX_Size() int {
|
||||
return xxx_messageInfo_UptimeCheckConfig_TcpCheck.Size(m)
|
||||
}
|
||||
func (m *UptimeCheckConfig_TcpCheck) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_UptimeCheckConfig_TcpCheck.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_UptimeCheckConfig_TcpCheck proto.InternalMessageInfo
|
||||
|
||||
func (m *UptimeCheckConfig_TcpCheck) GetPort() int32 {
|
||||
if m != nil {
|
||||
return m.Port
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// Used to perform string matching. Currently, this matches on the exact
|
||||
// content. In the future, it can be expanded to allow for regular expressions
|
||||
// and more complex matching.
|
||||
type UptimeCheckConfig_ContentMatcher struct {
|
||||
// String content to match (max 1024 bytes)
|
||||
Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *UptimeCheckConfig_ContentMatcher) Reset() { *m = UptimeCheckConfig_ContentMatcher{} }
|
||||
func (m *UptimeCheckConfig_ContentMatcher) String() string { return proto.CompactTextString(m) }
|
||||
func (*UptimeCheckConfig_ContentMatcher) ProtoMessage() {}
|
||||
func (*UptimeCheckConfig_ContentMatcher) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_0cd9344e0988a0e6, []int{1, 3}
|
||||
}
|
||||
func (m *UptimeCheckConfig_ContentMatcher) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UptimeCheckConfig_ContentMatcher.Unmarshal(m, b)
|
||||
}
|
||||
func (m *UptimeCheckConfig_ContentMatcher) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_UptimeCheckConfig_ContentMatcher.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *UptimeCheckConfig_ContentMatcher) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_UptimeCheckConfig_ContentMatcher.Merge(dst, src)
|
||||
}
|
||||
func (m *UptimeCheckConfig_ContentMatcher) XXX_Size() int {
|
||||
return xxx_messageInfo_UptimeCheckConfig_ContentMatcher.Size(m)
|
||||
}
|
||||
func (m *UptimeCheckConfig_ContentMatcher) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_UptimeCheckConfig_ContentMatcher.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_UptimeCheckConfig_ContentMatcher proto.InternalMessageInfo
|
||||
|
||||
func (m *UptimeCheckConfig_ContentMatcher) GetContent() string {
|
||||
if m != nil {
|
||||
return m.Content
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Contains the region, location, and list of IP
|
||||
// addresses where checkers in the location run from.
|
||||
type UptimeCheckIp struct {
|
||||
// A broad region category in which the IP address is located.
|
||||
Region UptimeCheckRegion `protobuf:"varint,1,opt,name=region,proto3,enum=google.monitoring.v3.UptimeCheckRegion" json:"region,omitempty"`
|
||||
// A more specific location within the region that typically encodes
|
||||
// a particular city/town/metro (and its containing state/province or country)
|
||||
// within the broader umbrella region category.
|
||||
Location string `protobuf:"bytes,2,opt,name=location,proto3" json:"location,omitempty"`
|
||||
// The IP address from which the uptime check originates. This is a full
|
||||
// IP address (not an IP address range). Most IP addresses, as of this
|
||||
// publication, are in IPv4 format; however, one should not rely on the
|
||||
// IP addresses being in IPv4 format indefinitely and should support
|
||||
// interpreting this field in either IPv4 or IPv6 format.
|
||||
IpAddress string `protobuf:"bytes,3,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *UptimeCheckIp) Reset() { *m = UptimeCheckIp{} }
|
||||
func (m *UptimeCheckIp) String() string { return proto.CompactTextString(m) }
|
||||
func (*UptimeCheckIp) ProtoMessage() {}
|
||||
func (*UptimeCheckIp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_0cd9344e0988a0e6, []int{2}
|
||||
}
|
||||
func (m *UptimeCheckIp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UptimeCheckIp.Unmarshal(m, b)
|
||||
}
|
||||
func (m *UptimeCheckIp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_UptimeCheckIp.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *UptimeCheckIp) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_UptimeCheckIp.Merge(dst, src)
|
||||
}
|
||||
func (m *UptimeCheckIp) XXX_Size() int {
|
||||
return xxx_messageInfo_UptimeCheckIp.Size(m)
|
||||
}
|
||||
func (m *UptimeCheckIp) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_UptimeCheckIp.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_UptimeCheckIp proto.InternalMessageInfo
|
||||
|
||||
func (m *UptimeCheckIp) GetRegion() UptimeCheckRegion {
|
||||
if m != nil {
|
||||
return m.Region
|
||||
}
|
||||
return UptimeCheckRegion_REGION_UNSPECIFIED
|
||||
}
|
||||
|
||||
func (m *UptimeCheckIp) GetLocation() string {
|
||||
if m != nil {
|
||||
return m.Location
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *UptimeCheckIp) GetIpAddress() string {
|
||||
if m != nil {
|
||||
return m.IpAddress
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*InternalChecker)(nil), "google.monitoring.v3.InternalChecker")
|
||||
proto.RegisterType((*UptimeCheckConfig)(nil), "google.monitoring.v3.UptimeCheckConfig")
|
||||
proto.RegisterType((*UptimeCheckConfig_ResourceGroup)(nil), "google.monitoring.v3.UptimeCheckConfig.ResourceGroup")
|
||||
proto.RegisterType((*UptimeCheckConfig_HttpCheck)(nil), "google.monitoring.v3.UptimeCheckConfig.HttpCheck")
|
||||
proto.RegisterMapType((map[string]string)(nil), "google.monitoring.v3.UptimeCheckConfig.HttpCheck.HeadersEntry")
|
||||
proto.RegisterType((*UptimeCheckConfig_HttpCheck_BasicAuthentication)(nil), "google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication")
|
||||
proto.RegisterType((*UptimeCheckConfig_TcpCheck)(nil), "google.monitoring.v3.UptimeCheckConfig.TcpCheck")
|
||||
proto.RegisterType((*UptimeCheckConfig_ContentMatcher)(nil), "google.monitoring.v3.UptimeCheckConfig.ContentMatcher")
|
||||
proto.RegisterType((*UptimeCheckIp)(nil), "google.monitoring.v3.UptimeCheckIp")
|
||||
proto.RegisterEnum("google.monitoring.v3.UptimeCheckRegion", UptimeCheckRegion_name, UptimeCheckRegion_value)
|
||||
proto.RegisterEnum("google.monitoring.v3.GroupResourceType", GroupResourceType_name, GroupResourceType_value)
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google/monitoring/v3/uptime.proto", fileDescriptor_uptime_0cd9344e0988a0e6)
|
||||
}
|
||||
|
||||
var fileDescriptor_uptime_0cd9344e0988a0e6 = []byte{
|
||||
// 1043 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xed, 0x6e, 0xe3, 0x44,
|
||||
0x17, 0x5e, 0x27, 0x6d, 0x3e, 0x4e, 0xfa, 0xe1, 0xce, 0xdb, 0x17, 0xdc, 0x48, 0x5d, 0xba, 0x45,
|
||||
0x88, 0xaa, 0x3f, 0x1c, 0xb6, 0x11, 0x08, 0x2d, 0xd2, 0x22, 0x27, 0x35, 0x8d, 0xa5, 0x36, 0x89,
|
||||
0x26, 0xcd, 0x02, 0x4b, 0x85, 0xe5, 0xda, 0x53, 0xc7, 0x34, 0xf1, 0x18, 0xcf, 0xb8, 0x4b, 0xb9,
|
||||
0x05, 0x2e, 0x83, 0x1f, 0x48, 0x5c, 0x01, 0xd7, 0xc0, 0x05, 0x70, 0x3d, 0xc8, 0xe3, 0x99, 0xb4,
|
||||
0x69, 0x8b, 0xb6, 0xfd, 0x37, 0xcf, 0xf9, 0x78, 0xe6, 0xf8, 0xcc, 0x79, 0x66, 0x0c, 0x2f, 0x42,
|
||||
0x4a, 0xc3, 0x29, 0x69, 0xcd, 0x68, 0x1c, 0x71, 0x9a, 0x46, 0x71, 0xd8, 0xba, 0x6a, 0xb7, 0xb2,
|
||||
0x84, 0x47, 0x33, 0x62, 0x26, 0x29, 0xe5, 0x14, 0x6d, 0x16, 0x21, 0xe6, 0x4d, 0x88, 0x79, 0xd5,
|
||||
0x6e, 0x7e, 0x2c, 0x13, 0xbd, 0x24, 0x52, 0xc9, 0x24, 0x70, 0x53, 0xc2, 0x68, 0x96, 0xfa, 0x32,
|
||||
0xb5, 0xf9, 0x5c, 0x06, 0x09, 0x74, 0x9e, 0x5d, 0xb4, 0x82, 0x2c, 0xf5, 0x78, 0x44, 0xe3, 0xc2,
|
||||
0xbf, 0xfb, 0x87, 0x06, 0xeb, 0x4e, 0xcc, 0x49, 0x1a, 0x7b, 0xd3, 0xee, 0x84, 0xf8, 0x97, 0x24,
|
||||
0x45, 0xdb, 0x00, 0x49, 0x4a, 0x7f, 0x22, 0x3e, 0x77, 0xa3, 0xc0, 0xd0, 0x76, 0xb4, 0xbd, 0x3a,
|
||||
0xae, 0x4b, 0x8b, 0x13, 0x20, 0x03, 0xaa, 0x31, 0xe1, 0xef, 0x68, 0x7a, 0x69, 0x94, 0x84, 0x4f,
|
||||
0x41, 0xb4, 0x05, 0xb5, 0xd0, 0x4f, 0xdc, 0x5f, 0x69, 0x4c, 0x8c, 0x72, 0xe1, 0x0a, 0xfd, 0xe4,
|
||||
0x2d, 0x8d, 0x49, 0xce, 0xe9, 0x17, 0xf4, 0x39, 0xe7, 0x52, 0xc1, 0x29, 0x2d, 0x4e, 0x80, 0x5e,
|
||||
0xc0, 0x4a, 0x10, 0xb1, 0x64, 0xea, 0x5d, 0xbb, 0xb1, 0x37, 0x23, 0xc6, 0xb2, 0x08, 0x68, 0x48,
|
||||
0x5b, 0xdf, 0x9b, 0x91, 0xdd, 0x7f, 0x1a, 0xb0, 0x31, 0x16, 0x5d, 0x11, 0x75, 0x76, 0x69, 0x7c,
|
||||
0x11, 0x85, 0x08, 0xc1, 0x92, 0x48, 0x28, 0xaa, 0x14, 0xeb, 0x7b, 0x64, 0xa5, 0x7b, 0x64, 0xa8,
|
||||
0x0f, 0xe8, 0x7e, 0xcb, 0x44, 0xcd, 0x8d, 0x83, 0x6d, 0x53, 0xb6, 0xdb, 0x4b, 0x22, 0xf3, 0x44,
|
||||
0x45, 0x61, 0x19, 0xd4, 0x7b, 0x86, 0x37, 0x66, 0x77, 0x8d, 0xe8, 0x47, 0x58, 0x53, 0x2c, 0x6e,
|
||||
0x98, 0xd2, 0x2c, 0x11, 0x9f, 0xd8, 0x38, 0xf8, 0xdc, 0x7c, 0xe8, 0xe8, 0xcc, 0x7b, 0xdf, 0x61,
|
||||
0x2a, 0xa6, 0xa3, 0x3c, 0xb9, 0xf7, 0x0c, 0xaf, 0xa6, 0xb7, 0x0d, 0x08, 0x03, 0x4c, 0x38, 0x4f,
|
||||
0x5c, 0xd1, 0x31, 0xd1, 0x9d, 0xc6, 0xc1, 0xcb, 0xc7, 0x72, 0xf7, 0x38, 0x4f, 0x04, 0xee, 0x69,
|
||||
0xb8, 0x3e, 0x51, 0x00, 0x0d, 0xa0, 0xce, 0x7d, 0x45, 0x59, 0x11, 0x94, 0x9f, 0x3d, 0x96, 0xf2,
|
||||
0xd4, 0x9f, 0x33, 0xd6, 0xb8, 0x5c, 0xa3, 0x97, 0x50, 0x49, 0x48, 0x1a, 0xd1, 0xc0, 0xa8, 0x0a,
|
||||
0xb6, 0x2d, 0xc5, 0xa6, 0x86, 0xcf, 0x3c, 0x94, 0xc3, 0x87, 0x65, 0x20, 0x6a, 0x43, 0x35, 0xa7,
|
||||
0xa6, 0x19, 0x37, 0x6a, 0xef, 0xcb, 0x51, 0x91, 0xc8, 0x03, 0xdd, 0xa7, 0x31, 0x27, 0x31, 0x77,
|
||||
0x67, 0x1e, 0xf7, 0x27, 0x24, 0x65, 0x46, 0x7d, 0xa7, 0xbc, 0xd7, 0x38, 0xf8, 0xe2, 0xb1, 0xf5,
|
||||
0x77, 0x8b, 0xfc, 0x93, 0x22, 0x1d, 0xaf, 0xfb, 0x0b, 0x98, 0x21, 0x0c, 0x3a, 0x23, 0x53, 0xe2,
|
||||
0x73, 0x31, 0x1e, 0x61, 0x44, 0x63, 0x66, 0xc0, 0x4e, 0x79, 0x6f, 0xed, 0xe0, 0xd3, 0xf7, 0x6e,
|
||||
0x81, 0x45, 0x3c, 0x5e, 0x57, 0x04, 0x05, 0x66, 0xe8, 0x23, 0x68, 0x44, 0xcc, 0x8d, 0xa4, 0xd8,
|
||||
0x8c, 0xf5, 0x1d, 0x6d, 0xaf, 0x86, 0x21, 0x62, 0x4a, 0x7e, 0x08, 0xc3, 0x86, 0xf2, 0xba, 0x52,
|
||||
0x1a, 0xcc, 0x58, 0x13, 0x1f, 0xf6, 0xc9, 0xc3, 0xbb, 0xde, 0x51, 0x2e, 0xd6, 0xa3, 0x45, 0x03,
|
||||
0x6b, 0xfe, 0x02, 0xab, 0x0b, 0xa3, 0x25, 0x34, 0x9a, 0x2f, 0x6e, 0xa4, 0x5d, 0x15, 0xd8, 0x09,
|
||||
0xd0, 0x31, 0xcc, 0xa7, 0xce, 0xe5, 0xd7, 0x49, 0x21, 0x9c, 0xff, 0xfc, 0x62, 0x41, 0xa7, 0xb8,
|
||||
0x4f, 0xaf, 0x13, 0x82, 0x57, 0xd2, 0x5b, 0xa8, 0xf9, 0x57, 0x19, 0xea, 0xf3, 0xc9, 0x43, 0x1f,
|
||||
0x42, 0x35, 0x63, 0xc4, 0x65, 0x6c, 0x2a, 0x76, 0xad, 0xe1, 0x4a, 0xc6, 0xc8, 0x88, 0x4d, 0x73,
|
||||
0x01, 0x27, 0x1e, 0x9f, 0x48, 0x91, 0x8a, 0xb5, 0xb0, 0xd1, 0x94, 0x0b, 0x3d, 0x2e, 0x63, 0xb1,
|
||||
0x46, 0xe7, 0x50, 0xf7, 0x32, 0x3e, 0x71, 0xa3, 0xf8, 0x82, 0x4a, 0x71, 0xd9, 0x4f, 0x16, 0x80,
|
||||
0xd9, 0xf1, 0x58, 0xe4, 0x5b, 0x19, 0x9f, 0x90, 0x98, 0x47, 0x7e, 0x31, 0x57, 0xb5, 0x9c, 0xd7,
|
||||
0x89, 0x2f, 0x68, 0x7e, 0x71, 0xcc, 0x3c, 0x76, 0xe9, 0x4e, 0x88, 0x17, 0xe4, 0xbd, 0x5f, 0x16,
|
||||
0x95, 0x36, 0x72, 0x5b, 0xaf, 0x30, 0xa1, 0xef, 0xa0, 0xaa, 0xbc, 0x15, 0x71, 0x32, 0xaf, 0x9f,
|
||||
0x5e, 0x84, 0xe4, 0xb2, 0x63, 0x9e, 0x5e, 0x63, 0x45, 0xd7, 0x3c, 0x81, 0xff, 0x3d, 0x50, 0x1d,
|
||||
0x6a, 0x42, 0x2d, 0x63, 0xf9, 0x99, 0xce, 0x2f, 0xb9, 0x39, 0xce, 0x7d, 0x89, 0xc7, 0xd8, 0x3b,
|
||||
0x9a, 0x06, 0xb2, 0x7f, 0x73, 0xdc, 0x7c, 0x05, 0x2b, 0xb7, 0xf7, 0x41, 0x3a, 0x94, 0x2f, 0xc9,
|
||||
0xb5, 0xa4, 0xc8, 0x97, 0x68, 0x13, 0x96, 0xaf, 0xbc, 0x69, 0xa6, 0xee, 0xc7, 0x02, 0xbc, 0x2a,
|
||||
0x7d, 0xa9, 0x35, 0x9f, 0x43, 0x4d, 0x09, 0x7c, 0x7e, 0x16, 0xda, 0xcd, 0x59, 0x34, 0xf7, 0x61,
|
||||
0x6d, 0x51, 0x40, 0xf9, 0x9b, 0x20, 0x25, 0xa4, 0x86, 0x4a, 0xc2, 0x0e, 0x40, 0x4d, 0x8d, 0x45,
|
||||
0x67, 0x13, 0x90, 0x98, 0x6b, 0x37, 0x25, 0x3f, 0x67, 0x84, 0x71, 0x31, 0x65, 0xbb, 0xbf, 0x69,
|
||||
0xb0, 0x7a, 0xab, 0x5d, 0x4e, 0x82, 0xbe, 0x86, 0x4a, 0x21, 0x3a, 0x41, 0xf6, 0x04, 0xcd, 0xc9,
|
||||
0xb4, 0xbc, 0x31, 0x53, 0x5a, 0x34, 0x50, 0x35, 0x46, 0xe1, 0xfc, 0x25, 0x8a, 0x12, 0xd7, 0x0b,
|
||||
0x82, 0x94, 0x30, 0x26, 0x9f, 0xa9, 0x7a, 0x94, 0x58, 0x85, 0x61, 0x9f, 0x2c, 0xbc, 0x32, 0x05,
|
||||
0x2f, 0xfa, 0x00, 0x10, 0xb6, 0x8f, 0x9c, 0x41, 0xdf, 0x1d, 0xf7, 0x47, 0x43, 0xbb, 0xeb, 0x7c,
|
||||
0xe3, 0xd8, 0x87, 0xfa, 0x33, 0x54, 0x85, 0xf2, 0x78, 0x64, 0xe9, 0x1a, 0x02, 0xa8, 0xd8, 0x63,
|
||||
0x3c, 0x18, 0xda, 0x7a, 0x09, 0x6d, 0xc0, 0xea, 0x68, 0x30, 0x3e, 0xed, 0xb9, 0xd6, 0x89, 0x8d,
|
||||
0x9d, 0xae, 0xa5, 0x97, 0x91, 0x0e, 0x2b, 0xd6, 0xc8, 0xb1, 0xdc, 0xa1, 0x95, 0xa7, 0x76, 0xf5,
|
||||
0xa5, 0xfd, 0x1f, 0x60, 0xe3, 0x9e, 0x80, 0xd0, 0x36, 0x6c, 0x61, 0x7b, 0x34, 0x18, 0xe3, 0xae,
|
||||
0xed, 0x9e, 0x7e, 0x3f, 0xb4, 0xef, 0xec, 0xb6, 0x02, 0x35, 0xa7, 0x3f, 0x3a, 0xb5, 0xfa, 0x5d,
|
||||
0x5b, 0xd7, 0xd0, 0x16, 0xfc, 0xdf, 0xfa, 0x76, 0xe4, 0xda, 0xc7, 0x1d, 0xf7, 0x78, 0x60, 0x1d,
|
||||
0xba, 0x1d, 0xeb, 0x38, 0xf7, 0x60, 0xbd, 0xd4, 0xf9, 0x5d, 0x03, 0xc3, 0xa7, 0xb3, 0x07, 0xbb,
|
||||
0xd6, 0x69, 0x14, 0x9f, 0x37, 0xcc, 0xef, 0xd7, 0xa1, 0xf6, 0xf6, 0xb5, 0x0c, 0x0a, 0xe9, 0xd4,
|
||||
0x8b, 0x43, 0x93, 0xa6, 0x61, 0x2b, 0x24, 0xb1, 0xb8, 0x7d, 0x5b, 0x85, 0xcb, 0x4b, 0x22, 0xb6,
|
||||
0xf8, 0x77, 0xf2, 0xd5, 0x0d, 0xfa, 0xb3, 0xd4, 0x3c, 0x2a, 0x08, 0xba, 0x53, 0x9a, 0x05, 0xea,
|
||||
0xbd, 0xcc, 0xf7, 0x7a, 0xd3, 0xfe, 0x5b, 0x39, 0xcf, 0x84, 0xf3, 0xec, 0xc6, 0x79, 0xf6, 0xa6,
|
||||
0x7d, 0x5e, 0x11, 0x9b, 0xb4, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x01, 0x68, 0xd9, 0xde, 0x01,
|
||||
0x09, 0x00, 0x00,
|
||||
}
|
||||
+786
@@ -0,0 +1,786 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/monitoring/v3/uptime_service.proto
|
||||
|
||||
package monitoring // import "google.golang.org/genproto/googleapis/monitoring/v3"
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import empty "github.com/golang/protobuf/ptypes/empty"
|
||||
import _ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
import field_mask "google.golang.org/genproto/protobuf/field_mask"
|
||||
|
||||
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
|
||||
|
||||
// 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 protocol for the `ListUptimeCheckConfigs` request.
|
||||
type ListUptimeCheckConfigsRequest struct {
|
||||
// The project whose uptime check configurations are listed. The format
|
||||
// is `projects/[PROJECT_ID]`.
|
||||
Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
|
||||
// The maximum number of results to return in a single response. The server
|
||||
// may further constrain the maximum number of results returned in a single
|
||||
// page. If the page_size is <=0, the server will decide the number of results
|
||||
// to be returned.
|
||||
PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
|
||||
// If this field is not empty then it must contain the `nextPageToken` value
|
||||
// returned by a previous call to this method. Using this field causes the
|
||||
// method to return more results from the previous method call.
|
||||
PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListUptimeCheckConfigsRequest) Reset() { *m = ListUptimeCheckConfigsRequest{} }
|
||||
func (m *ListUptimeCheckConfigsRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListUptimeCheckConfigsRequest) ProtoMessage() {}
|
||||
func (*ListUptimeCheckConfigsRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_service_4c86690095fa2cb1, []int{0}
|
||||
}
|
||||
func (m *ListUptimeCheckConfigsRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListUptimeCheckConfigsRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListUptimeCheckConfigsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListUptimeCheckConfigsRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ListUptimeCheckConfigsRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListUptimeCheckConfigsRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *ListUptimeCheckConfigsRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_ListUptimeCheckConfigsRequest.Size(m)
|
||||
}
|
||||
func (m *ListUptimeCheckConfigsRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListUptimeCheckConfigsRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListUptimeCheckConfigsRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *ListUptimeCheckConfigsRequest) GetParent() string {
|
||||
if m != nil {
|
||||
return m.Parent
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ListUptimeCheckConfigsRequest) GetPageSize() int32 {
|
||||
if m != nil {
|
||||
return m.PageSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ListUptimeCheckConfigsRequest) GetPageToken() string {
|
||||
if m != nil {
|
||||
return m.PageToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// The protocol for the `ListUptimeCheckConfigs` response.
|
||||
type ListUptimeCheckConfigsResponse struct {
|
||||
// The returned uptime check configurations.
|
||||
UptimeCheckConfigs []*UptimeCheckConfig `protobuf:"bytes,1,rep,name=uptime_check_configs,json=uptimeCheckConfigs,proto3" json:"uptime_check_configs,omitempty"`
|
||||
// This field represents the pagination token to retrieve the next page of
|
||||
// results. If the value is empty, it means no further results for the
|
||||
// request. To retrieve the next page of results, the value of the
|
||||
// next_page_token is passed to the subsequent List method call (in the
|
||||
// request message's page_token field).
|
||||
NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
|
||||
// The total number of uptime check configurations for the project,
|
||||
// irrespective of any pagination.
|
||||
TotalSize int32 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListUptimeCheckConfigsResponse) Reset() { *m = ListUptimeCheckConfigsResponse{} }
|
||||
func (m *ListUptimeCheckConfigsResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListUptimeCheckConfigsResponse) ProtoMessage() {}
|
||||
func (*ListUptimeCheckConfigsResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_service_4c86690095fa2cb1, []int{1}
|
||||
}
|
||||
func (m *ListUptimeCheckConfigsResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListUptimeCheckConfigsResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListUptimeCheckConfigsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListUptimeCheckConfigsResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ListUptimeCheckConfigsResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListUptimeCheckConfigsResponse.Merge(dst, src)
|
||||
}
|
||||
func (m *ListUptimeCheckConfigsResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_ListUptimeCheckConfigsResponse.Size(m)
|
||||
}
|
||||
func (m *ListUptimeCheckConfigsResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListUptimeCheckConfigsResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListUptimeCheckConfigsResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *ListUptimeCheckConfigsResponse) GetUptimeCheckConfigs() []*UptimeCheckConfig {
|
||||
if m != nil {
|
||||
return m.UptimeCheckConfigs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ListUptimeCheckConfigsResponse) GetNextPageToken() string {
|
||||
if m != nil {
|
||||
return m.NextPageToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ListUptimeCheckConfigsResponse) GetTotalSize() int32 {
|
||||
if m != nil {
|
||||
return m.TotalSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// The protocol for the `GetUptimeCheckConfig` request.
|
||||
type GetUptimeCheckConfigRequest struct {
|
||||
// The uptime check configuration to retrieve. The format
|
||||
// is `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`.
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetUptimeCheckConfigRequest) Reset() { *m = GetUptimeCheckConfigRequest{} }
|
||||
func (m *GetUptimeCheckConfigRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetUptimeCheckConfigRequest) ProtoMessage() {}
|
||||
func (*GetUptimeCheckConfigRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_service_4c86690095fa2cb1, []int{2}
|
||||
}
|
||||
func (m *GetUptimeCheckConfigRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetUptimeCheckConfigRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetUptimeCheckConfigRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetUptimeCheckConfigRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *GetUptimeCheckConfigRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetUptimeCheckConfigRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *GetUptimeCheckConfigRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_GetUptimeCheckConfigRequest.Size(m)
|
||||
}
|
||||
func (m *GetUptimeCheckConfigRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetUptimeCheckConfigRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetUptimeCheckConfigRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *GetUptimeCheckConfigRequest) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// The protocol for the `CreateUptimeCheckConfig` request.
|
||||
type CreateUptimeCheckConfigRequest struct {
|
||||
// The project in which to create the uptime check. The format
|
||||
// is `projects/[PROJECT_ID]`.
|
||||
Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
|
||||
// The new uptime check configuration.
|
||||
UptimeCheckConfig *UptimeCheckConfig `protobuf:"bytes,2,opt,name=uptime_check_config,json=uptimeCheckConfig,proto3" json:"uptime_check_config,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *CreateUptimeCheckConfigRequest) Reset() { *m = CreateUptimeCheckConfigRequest{} }
|
||||
func (m *CreateUptimeCheckConfigRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateUptimeCheckConfigRequest) ProtoMessage() {}
|
||||
func (*CreateUptimeCheckConfigRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_service_4c86690095fa2cb1, []int{3}
|
||||
}
|
||||
func (m *CreateUptimeCheckConfigRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_CreateUptimeCheckConfigRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *CreateUptimeCheckConfigRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_CreateUptimeCheckConfigRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *CreateUptimeCheckConfigRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_CreateUptimeCheckConfigRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *CreateUptimeCheckConfigRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_CreateUptimeCheckConfigRequest.Size(m)
|
||||
}
|
||||
func (m *CreateUptimeCheckConfigRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_CreateUptimeCheckConfigRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_CreateUptimeCheckConfigRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *CreateUptimeCheckConfigRequest) GetParent() string {
|
||||
if m != nil {
|
||||
return m.Parent
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CreateUptimeCheckConfigRequest) GetUptimeCheckConfig() *UptimeCheckConfig {
|
||||
if m != nil {
|
||||
return m.UptimeCheckConfig
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// The protocol for the `UpdateUptimeCheckConfig` request.
|
||||
type UpdateUptimeCheckConfigRequest struct {
|
||||
// Optional. If present, only the listed fields in the current uptime check
|
||||
// configuration are updated with values from the new configuration. If this
|
||||
// field is empty, then the current configuration is completely replaced with
|
||||
// the new configuration.
|
||||
UpdateMask *field_mask.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
|
||||
// Required. If an `"updateMask"` has been specified, this field gives
|
||||
// the values for the set of fields mentioned in the `"updateMask"`. If an
|
||||
// `"updateMask"` has not been given, this uptime check configuration replaces
|
||||
// the current configuration. If a field is mentioned in `"updateMask"` but
|
||||
// the corresonding field is omitted in this partial uptime check
|
||||
// configuration, it has the effect of deleting/clearing the field from the
|
||||
// configuration on the server.
|
||||
//
|
||||
// The following fields can be updated: `display_name`,
|
||||
// `http_check`, `tcp_check`, `timeout`, `content_matchers`, and
|
||||
// `selected_regions`.
|
||||
UptimeCheckConfig *UptimeCheckConfig `protobuf:"bytes,3,opt,name=uptime_check_config,json=uptimeCheckConfig,proto3" json:"uptime_check_config,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *UpdateUptimeCheckConfigRequest) Reset() { *m = UpdateUptimeCheckConfigRequest{} }
|
||||
func (m *UpdateUptimeCheckConfigRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*UpdateUptimeCheckConfigRequest) ProtoMessage() {}
|
||||
func (*UpdateUptimeCheckConfigRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_service_4c86690095fa2cb1, []int{4}
|
||||
}
|
||||
func (m *UpdateUptimeCheckConfigRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UpdateUptimeCheckConfigRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *UpdateUptimeCheckConfigRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_UpdateUptimeCheckConfigRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *UpdateUptimeCheckConfigRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_UpdateUptimeCheckConfigRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *UpdateUptimeCheckConfigRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_UpdateUptimeCheckConfigRequest.Size(m)
|
||||
}
|
||||
func (m *UpdateUptimeCheckConfigRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_UpdateUptimeCheckConfigRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_UpdateUptimeCheckConfigRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *UpdateUptimeCheckConfigRequest) GetUpdateMask() *field_mask.FieldMask {
|
||||
if m != nil {
|
||||
return m.UpdateMask
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UpdateUptimeCheckConfigRequest) GetUptimeCheckConfig() *UptimeCheckConfig {
|
||||
if m != nil {
|
||||
return m.UptimeCheckConfig
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// The protocol for the `DeleteUptimeCheckConfig` request.
|
||||
type DeleteUptimeCheckConfigRequest struct {
|
||||
// The uptime check configuration to delete. The format
|
||||
// is `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`.
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *DeleteUptimeCheckConfigRequest) Reset() { *m = DeleteUptimeCheckConfigRequest{} }
|
||||
func (m *DeleteUptimeCheckConfigRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*DeleteUptimeCheckConfigRequest) ProtoMessage() {}
|
||||
func (*DeleteUptimeCheckConfigRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_service_4c86690095fa2cb1, []int{5}
|
||||
}
|
||||
func (m *DeleteUptimeCheckConfigRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_DeleteUptimeCheckConfigRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *DeleteUptimeCheckConfigRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_DeleteUptimeCheckConfigRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *DeleteUptimeCheckConfigRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_DeleteUptimeCheckConfigRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *DeleteUptimeCheckConfigRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_DeleteUptimeCheckConfigRequest.Size(m)
|
||||
}
|
||||
func (m *DeleteUptimeCheckConfigRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_DeleteUptimeCheckConfigRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_DeleteUptimeCheckConfigRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *DeleteUptimeCheckConfigRequest) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// The protocol for the `ListUptimeCheckIps` request.
|
||||
type ListUptimeCheckIpsRequest struct {
|
||||
// The maximum number of results to return in a single response. The server
|
||||
// may further constrain the maximum number of results returned in a single
|
||||
// page. If the page_size is <=0, the server will decide the number of results
|
||||
// to be returned.
|
||||
// NOTE: this field is not yet implemented
|
||||
PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
|
||||
// If this field is not empty then it must contain the `nextPageToken` value
|
||||
// returned by a previous call to this method. Using this field causes the
|
||||
// method to return more results from the previous method call.
|
||||
// NOTE: this field is not yet implemented
|
||||
PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListUptimeCheckIpsRequest) Reset() { *m = ListUptimeCheckIpsRequest{} }
|
||||
func (m *ListUptimeCheckIpsRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListUptimeCheckIpsRequest) ProtoMessage() {}
|
||||
func (*ListUptimeCheckIpsRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_service_4c86690095fa2cb1, []int{6}
|
||||
}
|
||||
func (m *ListUptimeCheckIpsRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListUptimeCheckIpsRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListUptimeCheckIpsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListUptimeCheckIpsRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ListUptimeCheckIpsRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListUptimeCheckIpsRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *ListUptimeCheckIpsRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_ListUptimeCheckIpsRequest.Size(m)
|
||||
}
|
||||
func (m *ListUptimeCheckIpsRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListUptimeCheckIpsRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListUptimeCheckIpsRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *ListUptimeCheckIpsRequest) GetPageSize() int32 {
|
||||
if m != nil {
|
||||
return m.PageSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ListUptimeCheckIpsRequest) GetPageToken() string {
|
||||
if m != nil {
|
||||
return m.PageToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// The protocol for the `ListUptimeCheckIps` response.
|
||||
type ListUptimeCheckIpsResponse struct {
|
||||
// The returned list of IP addresses (including region and location) that the
|
||||
// checkers run from.
|
||||
UptimeCheckIps []*UptimeCheckIp `protobuf:"bytes,1,rep,name=uptime_check_ips,json=uptimeCheckIps,proto3" json:"uptime_check_ips,omitempty"`
|
||||
// This field represents the pagination token to retrieve the next page of
|
||||
// results. If the value is empty, it means no further results for the
|
||||
// request. To retrieve the next page of results, the value of the
|
||||
// next_page_token is passed to the subsequent List method call (in the
|
||||
// request message's page_token field).
|
||||
// NOTE: this field is not yet implemented
|
||||
NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListUptimeCheckIpsResponse) Reset() { *m = ListUptimeCheckIpsResponse{} }
|
||||
func (m *ListUptimeCheckIpsResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListUptimeCheckIpsResponse) ProtoMessage() {}
|
||||
func (*ListUptimeCheckIpsResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_uptime_service_4c86690095fa2cb1, []int{7}
|
||||
}
|
||||
func (m *ListUptimeCheckIpsResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListUptimeCheckIpsResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListUptimeCheckIpsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListUptimeCheckIpsResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ListUptimeCheckIpsResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListUptimeCheckIpsResponse.Merge(dst, src)
|
||||
}
|
||||
func (m *ListUptimeCheckIpsResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_ListUptimeCheckIpsResponse.Size(m)
|
||||
}
|
||||
func (m *ListUptimeCheckIpsResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListUptimeCheckIpsResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListUptimeCheckIpsResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *ListUptimeCheckIpsResponse) GetUptimeCheckIps() []*UptimeCheckIp {
|
||||
if m != nil {
|
||||
return m.UptimeCheckIps
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ListUptimeCheckIpsResponse) GetNextPageToken() string {
|
||||
if m != nil {
|
||||
return m.NextPageToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*ListUptimeCheckConfigsRequest)(nil), "google.monitoring.v3.ListUptimeCheckConfigsRequest")
|
||||
proto.RegisterType((*ListUptimeCheckConfigsResponse)(nil), "google.monitoring.v3.ListUptimeCheckConfigsResponse")
|
||||
proto.RegisterType((*GetUptimeCheckConfigRequest)(nil), "google.monitoring.v3.GetUptimeCheckConfigRequest")
|
||||
proto.RegisterType((*CreateUptimeCheckConfigRequest)(nil), "google.monitoring.v3.CreateUptimeCheckConfigRequest")
|
||||
proto.RegisterType((*UpdateUptimeCheckConfigRequest)(nil), "google.monitoring.v3.UpdateUptimeCheckConfigRequest")
|
||||
proto.RegisterType((*DeleteUptimeCheckConfigRequest)(nil), "google.monitoring.v3.DeleteUptimeCheckConfigRequest")
|
||||
proto.RegisterType((*ListUptimeCheckIpsRequest)(nil), "google.monitoring.v3.ListUptimeCheckIpsRequest")
|
||||
proto.RegisterType((*ListUptimeCheckIpsResponse)(nil), "google.monitoring.v3.ListUptimeCheckIpsResponse")
|
||||
}
|
||||
|
||||
// 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.SupportPackageIsVersion4
|
||||
|
||||
// UptimeCheckServiceClient is the client API for UptimeCheckService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type UptimeCheckServiceClient interface {
|
||||
// Lists the existing valid uptime check configurations for the project,
|
||||
// leaving out any invalid configurations.
|
||||
ListUptimeCheckConfigs(ctx context.Context, in *ListUptimeCheckConfigsRequest, opts ...grpc.CallOption) (*ListUptimeCheckConfigsResponse, error)
|
||||
// Gets a single uptime check configuration.
|
||||
GetUptimeCheckConfig(ctx context.Context, in *GetUptimeCheckConfigRequest, opts ...grpc.CallOption) (*UptimeCheckConfig, error)
|
||||
// Creates a new uptime check configuration.
|
||||
CreateUptimeCheckConfig(ctx context.Context, in *CreateUptimeCheckConfigRequest, opts ...grpc.CallOption) (*UptimeCheckConfig, error)
|
||||
// Updates an uptime check configuration. You can either replace the entire
|
||||
// configuration with a new one or replace only certain fields in the current
|
||||
// configuration by specifying the fields to be updated via `"updateMask"`.
|
||||
// Returns the updated configuration.
|
||||
UpdateUptimeCheckConfig(ctx context.Context, in *UpdateUptimeCheckConfigRequest, opts ...grpc.CallOption) (*UptimeCheckConfig, error)
|
||||
// Deletes an uptime check configuration. Note that this method will fail
|
||||
// if the uptime check configuration is referenced by an alert policy or
|
||||
// other dependent configs that would be rendered invalid by the deletion.
|
||||
DeleteUptimeCheckConfig(ctx context.Context, in *DeleteUptimeCheckConfigRequest, opts ...grpc.CallOption) (*empty.Empty, error)
|
||||
// Returns the list of IPs that checkers run from
|
||||
ListUptimeCheckIps(ctx context.Context, in *ListUptimeCheckIpsRequest, opts ...grpc.CallOption) (*ListUptimeCheckIpsResponse, error)
|
||||
}
|
||||
|
||||
type uptimeCheckServiceClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewUptimeCheckServiceClient(cc *grpc.ClientConn) UptimeCheckServiceClient {
|
||||
return &uptimeCheckServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *uptimeCheckServiceClient) ListUptimeCheckConfigs(ctx context.Context, in *ListUptimeCheckConfigsRequest, opts ...grpc.CallOption) (*ListUptimeCheckConfigsResponse, error) {
|
||||
out := new(ListUptimeCheckConfigsResponse)
|
||||
err := c.cc.Invoke(ctx, "/google.monitoring.v3.UptimeCheckService/ListUptimeCheckConfigs", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *uptimeCheckServiceClient) GetUptimeCheckConfig(ctx context.Context, in *GetUptimeCheckConfigRequest, opts ...grpc.CallOption) (*UptimeCheckConfig, error) {
|
||||
out := new(UptimeCheckConfig)
|
||||
err := c.cc.Invoke(ctx, "/google.monitoring.v3.UptimeCheckService/GetUptimeCheckConfig", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *uptimeCheckServiceClient) CreateUptimeCheckConfig(ctx context.Context, in *CreateUptimeCheckConfigRequest, opts ...grpc.CallOption) (*UptimeCheckConfig, error) {
|
||||
out := new(UptimeCheckConfig)
|
||||
err := c.cc.Invoke(ctx, "/google.monitoring.v3.UptimeCheckService/CreateUptimeCheckConfig", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *uptimeCheckServiceClient) UpdateUptimeCheckConfig(ctx context.Context, in *UpdateUptimeCheckConfigRequest, opts ...grpc.CallOption) (*UptimeCheckConfig, error) {
|
||||
out := new(UptimeCheckConfig)
|
||||
err := c.cc.Invoke(ctx, "/google.monitoring.v3.UptimeCheckService/UpdateUptimeCheckConfig", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *uptimeCheckServiceClient) DeleteUptimeCheckConfig(ctx context.Context, in *DeleteUptimeCheckConfigRequest, opts ...grpc.CallOption) (*empty.Empty, error) {
|
||||
out := new(empty.Empty)
|
||||
err := c.cc.Invoke(ctx, "/google.monitoring.v3.UptimeCheckService/DeleteUptimeCheckConfig", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *uptimeCheckServiceClient) ListUptimeCheckIps(ctx context.Context, in *ListUptimeCheckIpsRequest, opts ...grpc.CallOption) (*ListUptimeCheckIpsResponse, error) {
|
||||
out := new(ListUptimeCheckIpsResponse)
|
||||
err := c.cc.Invoke(ctx, "/google.monitoring.v3.UptimeCheckService/ListUptimeCheckIps", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// UptimeCheckServiceServer is the server API for UptimeCheckService service.
|
||||
type UptimeCheckServiceServer interface {
|
||||
// Lists the existing valid uptime check configurations for the project,
|
||||
// leaving out any invalid configurations.
|
||||
ListUptimeCheckConfigs(context.Context, *ListUptimeCheckConfigsRequest) (*ListUptimeCheckConfigsResponse, error)
|
||||
// Gets a single uptime check configuration.
|
||||
GetUptimeCheckConfig(context.Context, *GetUptimeCheckConfigRequest) (*UptimeCheckConfig, error)
|
||||
// Creates a new uptime check configuration.
|
||||
CreateUptimeCheckConfig(context.Context, *CreateUptimeCheckConfigRequest) (*UptimeCheckConfig, error)
|
||||
// Updates an uptime check configuration. You can either replace the entire
|
||||
// configuration with a new one or replace only certain fields in the current
|
||||
// configuration by specifying the fields to be updated via `"updateMask"`.
|
||||
// Returns the updated configuration.
|
||||
UpdateUptimeCheckConfig(context.Context, *UpdateUptimeCheckConfigRequest) (*UptimeCheckConfig, error)
|
||||
// Deletes an uptime check configuration. Note that this method will fail
|
||||
// if the uptime check configuration is referenced by an alert policy or
|
||||
// other dependent configs that would be rendered invalid by the deletion.
|
||||
DeleteUptimeCheckConfig(context.Context, *DeleteUptimeCheckConfigRequest) (*empty.Empty, error)
|
||||
// Returns the list of IPs that checkers run from
|
||||
ListUptimeCheckIps(context.Context, *ListUptimeCheckIpsRequest) (*ListUptimeCheckIpsResponse, error)
|
||||
}
|
||||
|
||||
func RegisterUptimeCheckServiceServer(s *grpc.Server, srv UptimeCheckServiceServer) {
|
||||
s.RegisterService(&_UptimeCheckService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _UptimeCheckService_ListUptimeCheckConfigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListUptimeCheckConfigsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UptimeCheckServiceServer).ListUptimeCheckConfigs(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.monitoring.v3.UptimeCheckService/ListUptimeCheckConfigs",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UptimeCheckServiceServer).ListUptimeCheckConfigs(ctx, req.(*ListUptimeCheckConfigsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UptimeCheckService_GetUptimeCheckConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetUptimeCheckConfigRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UptimeCheckServiceServer).GetUptimeCheckConfig(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.monitoring.v3.UptimeCheckService/GetUptimeCheckConfig",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UptimeCheckServiceServer).GetUptimeCheckConfig(ctx, req.(*GetUptimeCheckConfigRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UptimeCheckService_CreateUptimeCheckConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateUptimeCheckConfigRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UptimeCheckServiceServer).CreateUptimeCheckConfig(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.monitoring.v3.UptimeCheckService/CreateUptimeCheckConfig",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UptimeCheckServiceServer).CreateUptimeCheckConfig(ctx, req.(*CreateUptimeCheckConfigRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UptimeCheckService_UpdateUptimeCheckConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateUptimeCheckConfigRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UptimeCheckServiceServer).UpdateUptimeCheckConfig(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.monitoring.v3.UptimeCheckService/UpdateUptimeCheckConfig",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UptimeCheckServiceServer).UpdateUptimeCheckConfig(ctx, req.(*UpdateUptimeCheckConfigRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UptimeCheckService_DeleteUptimeCheckConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteUptimeCheckConfigRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UptimeCheckServiceServer).DeleteUptimeCheckConfig(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.monitoring.v3.UptimeCheckService/DeleteUptimeCheckConfig",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UptimeCheckServiceServer).DeleteUptimeCheckConfig(ctx, req.(*DeleteUptimeCheckConfigRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UptimeCheckService_ListUptimeCheckIps_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListUptimeCheckIpsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UptimeCheckServiceServer).ListUptimeCheckIps(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.monitoring.v3.UptimeCheckService/ListUptimeCheckIps",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UptimeCheckServiceServer).ListUptimeCheckIps(ctx, req.(*ListUptimeCheckIpsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _UptimeCheckService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "google.monitoring.v3.UptimeCheckService",
|
||||
HandlerType: (*UptimeCheckServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "ListUptimeCheckConfigs",
|
||||
Handler: _UptimeCheckService_ListUptimeCheckConfigs_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetUptimeCheckConfig",
|
||||
Handler: _UptimeCheckService_GetUptimeCheckConfig_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateUptimeCheckConfig",
|
||||
Handler: _UptimeCheckService_CreateUptimeCheckConfig_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateUptimeCheckConfig",
|
||||
Handler: _UptimeCheckService_UpdateUptimeCheckConfig_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteUptimeCheckConfig",
|
||||
Handler: _UptimeCheckService_DeleteUptimeCheckConfig_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListUptimeCheckIps",
|
||||
Handler: _UptimeCheckService_ListUptimeCheckIps_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "google/monitoring/v3/uptime_service.proto",
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google/monitoring/v3/uptime_service.proto", fileDescriptor_uptime_service_4c86690095fa2cb1)
|
||||
}
|
||||
|
||||
var fileDescriptor_uptime_service_4c86690095fa2cb1 = []byte{
|
||||
// 747 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcd, 0x6e, 0xd3, 0x4a,
|
||||
0x14, 0xd6, 0x24, 0xbd, 0x55, 0x7b, 0xaa, 0x7b, 0x2f, 0x0c, 0x51, 0x1b, 0x5c, 0x1a, 0x05, 0x23,
|
||||
0x41, 0x89, 0x90, 0x4d, 0x93, 0xae, 0xa8, 0xa8, 0x44, 0x03, 0x54, 0x95, 0xa8, 0x54, 0xa5, 0xb4,
|
||||
0x15, 0x50, 0x29, 0x72, 0xd3, 0xa9, 0x31, 0x49, 0x3c, 0xc6, 0x33, 0xae, 0xa0, 0xa8, 0x1b, 0xde,
|
||||
0x00, 0x75, 0xc9, 0x9e, 0x45, 0x1f, 0x00, 0xd6, 0xb0, 0x41, 0x62, 0x8b, 0x78, 0x03, 0x1e, 0x04,
|
||||
0x79, 0x3c, 0x26, 0x7f, 0x63, 0xe3, 0x88, 0x5d, 0x3c, 0xe7, 0xcc, 0x39, 0xdf, 0xf9, 0xfc, 0x9d,
|
||||
0x2f, 0x86, 0x9b, 0x36, 0xa5, 0x76, 0x87, 0x98, 0x5d, 0xea, 0x3a, 0x9c, 0xfa, 0x8e, 0x6b, 0x9b,
|
||||
0xc7, 0x35, 0x33, 0xf0, 0xb8, 0xd3, 0x25, 0x4d, 0x46, 0xfc, 0x63, 0xa7, 0x45, 0x0c, 0xcf, 0xa7,
|
||||
0x9c, 0xe2, 0x42, 0x94, 0x6a, 0xf4, 0x52, 0x8d, 0xe3, 0x9a, 0x76, 0x45, 0x16, 0xb0, 0x3c, 0xc7,
|
||||
0xb4, 0x5c, 0x97, 0x72, 0x8b, 0x3b, 0xd4, 0x65, 0xd1, 0x1d, 0xed, 0x6a, 0x4a, 0x79, 0x99, 0x32,
|
||||
0x2f, 0x53, 0xc4, 0xd3, 0x41, 0x70, 0x64, 0x92, 0xae, 0xc7, 0x5f, 0xcb, 0x60, 0x79, 0x38, 0x78,
|
||||
0xe4, 0x90, 0xce, 0x61, 0xb3, 0x6b, 0xb1, 0x76, 0x94, 0xa1, 0x33, 0x58, 0x78, 0xe4, 0x30, 0xbe,
|
||||
0x23, 0x4a, 0xd6, 0x9f, 0x93, 0x56, 0xbb, 0x4e, 0xdd, 0x23, 0xc7, 0x66, 0x0d, 0xf2, 0x32, 0x20,
|
||||
0x8c, 0xe3, 0x59, 0x98, 0xf4, 0x2c, 0x9f, 0xb8, 0xbc, 0x88, 0xca, 0x68, 0x71, 0xba, 0x21, 0x9f,
|
||||
0xf0, 0x3c, 0x4c, 0x7b, 0x96, 0x4d, 0x9a, 0xcc, 0x39, 0x21, 0xc5, 0x7c, 0x19, 0x2d, 0xfe, 0xd3,
|
||||
0x98, 0x0a, 0x0f, 0xb6, 0x9d, 0x13, 0x82, 0x17, 0x00, 0x44, 0x90, 0xd3, 0x36, 0x71, 0x8b, 0x13,
|
||||
0xe2, 0xa2, 0x48, 0x7f, 0x1c, 0x1e, 0xe8, 0x5f, 0x10, 0x94, 0x92, 0xba, 0x32, 0x8f, 0xba, 0x8c,
|
||||
0xe0, 0x27, 0x50, 0x90, 0x2c, 0xb6, 0xc2, 0x70, 0xb3, 0x15, 0xc5, 0x8b, 0xa8, 0x9c, 0x5f, 0x9c,
|
||||
0xa9, 0xde, 0x30, 0x54, 0x64, 0x1a, 0x23, 0xf5, 0x1a, 0x38, 0x18, 0x69, 0x81, 0xaf, 0xc3, 0xff,
|
||||
0x2e, 0x79, 0xc5, 0x9b, 0x7d, 0x08, 0x73, 0x02, 0xe1, 0xbf, 0xe1, 0xf1, 0x56, 0x8c, 0x32, 0x1c,
|
||||
0x82, 0x53, 0x6e, 0x75, 0xfa, 0x47, 0x9c, 0x16, 0x27, 0xe1, 0x8c, 0xfa, 0x12, 0xcc, 0xaf, 0x93,
|
||||
0xd1, 0x11, 0x62, 0xde, 0x30, 0x4c, 0xb8, 0x56, 0x97, 0x48, 0xd6, 0xc4, 0x6f, 0xfd, 0x1d, 0x82,
|
||||
0x52, 0xdd, 0x27, 0x16, 0x27, 0x89, 0xd7, 0x92, 0xe8, 0xde, 0x83, 0x4b, 0x0a, 0x3e, 0x04, 0xf0,
|
||||
0x31, 0xe8, 0xb8, 0x38, 0x42, 0x87, 0xfe, 0x11, 0x41, 0x69, 0xc7, 0x3b, 0x4c, 0xc3, 0xb4, 0x02,
|
||||
0x33, 0x81, 0xc8, 0x10, 0xc2, 0x91, 0x3d, 0xb5, 0xb8, 0x67, 0xac, 0x2d, 0xe3, 0x61, 0xa8, 0xad,
|
||||
0x4d, 0x8b, 0xb5, 0x1b, 0x10, 0xa5, 0x87, 0xbf, 0x93, 0x80, 0xe7, 0xff, 0x1a, 0xf8, 0x32, 0x94,
|
||||
0xee, 0x93, 0x0e, 0x49, 0xc1, 0xad, 0x7a, 0x05, 0x7b, 0x70, 0x79, 0x48, 0x79, 0x1b, 0xde, 0x6f,
|
||||
0xad, 0x0f, 0x68, 0x3a, 0x97, 0xaa, 0xe9, 0xfc, 0xb0, 0xa6, 0xcf, 0x10, 0x68, 0xaa, 0xca, 0x52,
|
||||
0xcf, 0x9b, 0x70, 0x61, 0x80, 0x06, 0xc7, 0x8b, 0xb5, 0x7c, 0xed, 0x8f, 0x1c, 0x6c, 0x78, 0x8d,
|
||||
0xff, 0x82, 0x81, 0xb2, 0x59, 0x35, 0x5c, 0xfd, 0x3a, 0x05, 0xb8, 0xaf, 0xd2, 0x76, 0xe4, 0x48,
|
||||
0xf8, 0x13, 0x82, 0x59, 0xf5, 0x02, 0xe2, 0x9a, 0x1a, 0x4e, 0xaa, 0x49, 0x68, 0xcb, 0xe3, 0x5d,
|
||||
0x8a, 0x38, 0xd1, 0xab, 0x6f, 0xbf, 0xff, 0x3c, 0xcb, 0xdd, 0xc2, 0x95, 0xd0, 0xd4, 0xde, 0x44,
|
||||
0x42, 0xbf, 0xeb, 0xf9, 0xf4, 0x05, 0x69, 0x71, 0x66, 0x56, 0x4e, 0x4d, 0xc5, 0xf2, 0x7e, 0x40,
|
||||
0x50, 0x50, 0xad, 0x1d, 0x5e, 0x52, 0x43, 0x48, 0x59, 0x51, 0x2d, 0xab, 0xfa, 0x86, 0x80, 0x86,
|
||||
0x3a, 0xea, 0x83, 0xa9, 0x40, 0x69, 0x56, 0x4e, 0xf1, 0x67, 0x04, 0x73, 0x09, 0xbb, 0x8e, 0x13,
|
||||
0xe8, 0x4a, 0xb7, 0x86, 0xec, 0x70, 0xd7, 0x05, 0xdc, 0x7b, 0xfa, 0x18, 0xbc, 0xde, 0x51, 0x2d,
|
||||
0x29, 0xfe, 0x81, 0x60, 0x2e, 0xc1, 0x1b, 0x92, 0x66, 0x48, 0xb7, 0x92, 0xec, 0x33, 0x3c, 0x13,
|
||||
0x33, 0xec, 0x54, 0x57, 0xc5, 0x0c, 0x0a, 0x70, 0x46, 0xa6, 0xd7, 0xa0, 0x9e, 0xeb, 0x3d, 0x82,
|
||||
0xb9, 0x04, 0xef, 0x48, 0x9a, 0x2b, 0xdd, 0x6a, 0xb4, 0xd9, 0x11, 0x37, 0x7c, 0x10, 0xfe, 0x0d,
|
||||
0xc7, 0xca, 0xa9, 0x8c, 0xa3, 0x9c, 0x33, 0x04, 0x78, 0xd4, 0x49, 0xb0, 0x99, 0x69, 0xc7, 0x7a,
|
||||
0x6e, 0xa6, 0xdd, 0xce, 0x7e, 0x41, 0x2e, 0xa4, 0x26, 0xd0, 0x16, 0x30, 0xee, 0x7d, 0x65, 0xc4,
|
||||
0x39, 0x6b, 0xe7, 0x08, 0x8a, 0x2d, 0xda, 0x55, 0xd6, 0x5c, 0x93, 0x1e, 0x23, 0xed, 0x65, 0x2b,
|
||||
0xe4, 0x60, 0x0b, 0x3d, 0x5d, 0x95, 0xb9, 0x36, 0xed, 0x58, 0xae, 0x6d, 0x50, 0xdf, 0x36, 0x6d,
|
||||
0xe2, 0x0a, 0x86, 0xcc, 0x28, 0x64, 0x79, 0x0e, 0x1b, 0xfc, 0xb8, 0x59, 0xe9, 0x3d, 0x9d, 0xe7,
|
||||
0xb4, 0xf5, 0xa8, 0x40, 0xbd, 0x43, 0x83, 0x43, 0x63, 0xb3, 0xd7, 0x72, 0xb7, 0xf6, 0x2d, 0x0e,
|
||||
0xee, 0x8b, 0xe0, 0x7e, 0x2f, 0xb8, 0xbf, 0x5b, 0x3b, 0x98, 0x14, 0x4d, 0x6a, 0xbf, 0x02, 0x00,
|
||||
0x00, 0xff, 0xff, 0x27, 0xb8, 0x65, 0x92, 0x9f, 0x09, 0x00, 0x00,
|
||||
}
|
||||
+280
@@ -0,0 +1,280 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: google/protobuf/field_mask.proto
|
||||
|
||||
package field_mask // import "google.golang.org/genproto/protobuf/field_mask"
|
||||
|
||||
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
|
||||
|
||||
// `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
|
||||
// paths string.
|
||||
//
|
||||
// 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, new values will
|
||||
// be appended to the existing repeated field in the target resource. Note that
|
||||
// a repeated field is only allowed in the last position of a `paths` string.
|
||||
//
|
||||
// If a sub-message is specified in the last position of the field mask for an
|
||||
// update operation, then new value will be merged into the existing sub-message
|
||||
// in the target resource.
|
||||
//
|
||||
// For example, given the target message:
|
||||
//
|
||||
// f {
|
||||
// b {
|
||||
// d: 1
|
||||
// x: 2
|
||||
// }
|
||||
// c: [1]
|
||||
// }
|
||||
//
|
||||
// And an update message:
|
||||
//
|
||||
// f {
|
||||
// b {
|
||||
// d: 10
|
||||
// }
|
||||
// c: [2]
|
||||
// }
|
||||
//
|
||||
// then if the field mask is:
|
||||
//
|
||||
// paths: ["f.b", "f.c"]
|
||||
//
|
||||
// then the result will be:
|
||||
//
|
||||
// f {
|
||||
// b {
|
||||
// d: 10
|
||||
// x: 2
|
||||
// }
|
||||
// c: [1, 2]
|
||||
// }
|
||||
//
|
||||
// An implementation may provide options to override this default behavior for
|
||||
// repeated and message fields.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// ## Field Mask Verification
|
||||
//
|
||||
// The implementation of any API method which has a FieldMask type field in the
|
||||
// request should verify the included field paths, and return an
|
||||
// `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
|
||||
type FieldMask struct {
|
||||
// The set of field mask paths.
|
||||
Paths []string `protobuf:"bytes,1,rep,name=paths,proto3" json:"paths,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *FieldMask) Reset() { *m = FieldMask{} }
|
||||
func (m *FieldMask) String() string { return proto.CompactTextString(m) }
|
||||
func (*FieldMask) ProtoMessage() {}
|
||||
func (*FieldMask) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_field_mask_02a8b0c0831edcce, []int{0}
|
||||
}
|
||||
func (m *FieldMask) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_FieldMask.Unmarshal(m, b)
|
||||
}
|
||||
func (m *FieldMask) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_FieldMask.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *FieldMask) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_FieldMask.Merge(dst, src)
|
||||
}
|
||||
func (m *FieldMask) XXX_Size() int {
|
||||
return xxx_messageInfo_FieldMask.Size(m)
|
||||
}
|
||||
func (m *FieldMask) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_FieldMask.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_FieldMask proto.InternalMessageInfo
|
||||
|
||||
func (m *FieldMask) GetPaths() []string {
|
||||
if m != nil {
|
||||
return m.Paths
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*FieldMask)(nil), "google.protobuf.FieldMask")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("google/protobuf/field_mask.proto", fileDescriptor_field_mask_02a8b0c0831edcce)
|
||||
}
|
||||
|
||||
var fileDescriptor_field_mask_02a8b0c0831edcce = []byte{
|
||||
// 175 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcb, 0x4c, 0xcd,
|
||||
0x49, 0x89, 0xcf, 0x4d, 0x2c, 0xce, 0xd6, 0x03, 0x8b, 0x09, 0xf1, 0x43, 0x54, 0xe8, 0xc1, 0x54,
|
||||
0x28, 0x29, 0x72, 0x71, 0xba, 0x81, 0x14, 0xf9, 0x26, 0x16, 0x67, 0x0b, 0x89, 0x70, 0xb1, 0x16,
|
||||
0x24, 0x96, 0x64, 0x14, 0x4b, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x06, 0x41, 0x38, 0x4e, 0x3d, 0x8c,
|
||||
0x5c, 0xc2, 0xc9, 0xf9, 0xb9, 0x7a, 0x68, 0x5a, 0x9d, 0xf8, 0xe0, 0x1a, 0x03, 0x40, 0x42, 0x01,
|
||||
0x8c, 0x51, 0x96, 0x50, 0x25, 0xe9, 0xf9, 0x39, 0x89, 0x79, 0xe9, 0x7a, 0xf9, 0x45, 0xe9, 0xfa,
|
||||
0xe9, 0xa9, 0x79, 0x60, 0x0d, 0xd8, 0xdc, 0x64, 0x8d, 0x60, 0xfe, 0x60, 0x64, 0x5c, 0xc4, 0xc4,
|
||||
0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0x62, 0x48, 0x00, 0x54, 0x83, 0x5e, 0x78, 0x6a,
|
||||
0x4e, 0x8e, 0x77, 0x5e, 0x7e, 0x79, 0x5e, 0x48, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x24,
|
||||
0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfd, 0xda, 0xb7, 0xa8, 0xed, 0x00, 0x00, 0x00,
|
||||
}
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* 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 oauth implements gRPC credentials using OAuth.
|
||||
package oauth
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"sync"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/oauth2"
|
||||
"golang.org/x/oauth2/google"
|
||||
"golang.org/x/oauth2/jwt"
|
||||
"google.golang.org/grpc/credentials"
|
||||
)
|
||||
|
||||
// TokenSource supplies PerRPCCredentials from an oauth2.TokenSource.
|
||||
type TokenSource struct {
|
||||
oauth2.TokenSource
|
||||
}
|
||||
|
||||
// GetRequestMetadata gets the request metadata as a map from a TokenSource.
|
||||
func (ts TokenSource) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {
|
||||
token, err := ts.Token()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return map[string]string{
|
||||
"authorization": token.Type() + " " + token.AccessToken,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// RequireTransportSecurity indicates whether the credentials requires transport security.
|
||||
func (ts TokenSource) RequireTransportSecurity() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
type jwtAccess struct {
|
||||
jsonKey []byte
|
||||
}
|
||||
|
||||
// NewJWTAccessFromFile creates PerRPCCredentials from the given keyFile.
|
||||
func NewJWTAccessFromFile(keyFile string) (credentials.PerRPCCredentials, error) {
|
||||
jsonKey, err := ioutil.ReadFile(keyFile)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("credentials: failed to read the service account key file: %v", err)
|
||||
}
|
||||
return NewJWTAccessFromKey(jsonKey)
|
||||
}
|
||||
|
||||
// NewJWTAccessFromKey creates PerRPCCredentials from the given jsonKey.
|
||||
func NewJWTAccessFromKey(jsonKey []byte) (credentials.PerRPCCredentials, error) {
|
||||
return jwtAccess{jsonKey}, nil
|
||||
}
|
||||
|
||||
func (j jwtAccess) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {
|
||||
ts, err := google.JWTAccessTokenSourceFromJSON(j.jsonKey, uri[0])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
token, err := ts.Token()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return map[string]string{
|
||||
"authorization": token.Type() + " " + token.AccessToken,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (j jwtAccess) RequireTransportSecurity() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// oauthAccess supplies PerRPCCredentials from a given token.
|
||||
type oauthAccess struct {
|
||||
token oauth2.Token
|
||||
}
|
||||
|
||||
// NewOauthAccess constructs the PerRPCCredentials using a given token.
|
||||
func NewOauthAccess(token *oauth2.Token) credentials.PerRPCCredentials {
|
||||
return oauthAccess{token: *token}
|
||||
}
|
||||
|
||||
func (oa oauthAccess) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {
|
||||
return map[string]string{
|
||||
"authorization": oa.token.Type() + " " + oa.token.AccessToken,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (oa oauthAccess) RequireTransportSecurity() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// NewComputeEngine constructs the PerRPCCredentials that fetches access tokens from
|
||||
// Google Compute Engine (GCE)'s metadata server. It is only valid to use this
|
||||
// if your program is running on a GCE instance.
|
||||
// TODO(dsymonds): Deprecate and remove this.
|
||||
func NewComputeEngine() credentials.PerRPCCredentials {
|
||||
return TokenSource{google.ComputeTokenSource("")}
|
||||
}
|
||||
|
||||
// serviceAccount represents PerRPCCredentials via JWT signing key.
|
||||
type serviceAccount struct {
|
||||
mu sync.Mutex
|
||||
config *jwt.Config
|
||||
t *oauth2.Token
|
||||
}
|
||||
|
||||
func (s *serviceAccount) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
if !s.t.Valid() {
|
||||
var err error
|
||||
s.t, err = s.config.TokenSource(ctx).Token()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return map[string]string{
|
||||
"authorization": s.t.Type() + " " + s.t.AccessToken,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *serviceAccount) RequireTransportSecurity() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// NewServiceAccountFromKey constructs the PerRPCCredentials using the JSON key slice
|
||||
// from a Google Developers service account.
|
||||
func NewServiceAccountFromKey(jsonKey []byte, scope ...string) (credentials.PerRPCCredentials, error) {
|
||||
config, err := google.JWTConfigFromJSON(jsonKey, scope...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &serviceAccount{config: config}, nil
|
||||
}
|
||||
|
||||
// NewServiceAccountFromFile constructs the PerRPCCredentials using the JSON key file
|
||||
// of a Google Developers service account.
|
||||
func NewServiceAccountFromFile(keyFile string, scope ...string) (credentials.PerRPCCredentials, error) {
|
||||
jsonKey, err := ioutil.ReadFile(keyFile)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("credentials: failed to read the service account key file: %v", err)
|
||||
}
|
||||
return NewServiceAccountFromKey(jsonKey, scope...)
|
||||
}
|
||||
|
||||
// NewApplicationDefault returns "Application Default Credentials". For more
|
||||
// detail, see https://developers.google.com/accounts/docs/application-default-credentials.
|
||||
func NewApplicationDefault(ctx context.Context, scope ...string) (credentials.PerRPCCredentials, error) {
|
||||
t, err := google.DefaultTokenSource(ctx, scope...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return TokenSource{t}, nil
|
||||
}
|
||||
Vendored
+38
-18
@@ -1,5 +1,7 @@
|
||||
# cloud.google.com/go v0.26.0
|
||||
cloud.google.com/go/storage
|
||||
cloud.google.com/go/monitoring/apiv3
|
||||
cloud.google.com/go/trace/apiv2
|
||||
cloud.google.com/go/iam
|
||||
cloud.google.com/go/internal
|
||||
cloud.google.com/go/internal/optional
|
||||
@@ -7,6 +9,8 @@ cloud.google.com/go/internal/trace
|
||||
cloud.google.com/go/internal/version
|
||||
cloud.google.com/go/compute/metadata
|
||||
# contrib.go.opencensus.io/exporter/stackdriver v0.6.0
|
||||
contrib.go.opencensus.io/exporter/stackdriver
|
||||
contrib.go.opencensus.io/exporter/stackdriver/monitoredresource
|
||||
contrib.go.opencensus.io/exporter/stackdriver/propagation
|
||||
# git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999
|
||||
git.apache.org/thrift.git/lib/go/thrift
|
||||
@@ -40,21 +44,21 @@ github.com/aws/aws-sdk-go/aws/request
|
||||
github.com/aws/aws-sdk-go/aws/awsutil
|
||||
github.com/aws/aws-sdk-go/service/s3
|
||||
github.com/aws/aws-sdk-go/service/s3/s3iface
|
||||
github.com/aws/aws-sdk-go/aws/ec2metadata
|
||||
github.com/aws/aws-sdk-go/internal/shareddefaults
|
||||
github.com/aws/aws-sdk-go/aws/client/metadata
|
||||
github.com/aws/aws-sdk-go/internal/sdkrand
|
||||
github.com/aws/aws-sdk-go/service/sts
|
||||
github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds
|
||||
github.com/aws/aws-sdk-go/aws/credentials/endpointcreds
|
||||
github.com/aws/aws-sdk-go/aws/ec2metadata
|
||||
github.com/aws/aws-sdk-go/aws/signer/v4
|
||||
github.com/aws/aws-sdk-go/private/protocol
|
||||
github.com/aws/aws-sdk-go/private/protocol/eventstream
|
||||
github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi
|
||||
github.com/aws/aws-sdk-go/private/protocol/rest
|
||||
github.com/aws/aws-sdk-go/private/protocol/restxml
|
||||
github.com/aws/aws-sdk-go/private/protocol/query
|
||||
github.com/aws/aws-sdk-go/internal/sdkuri
|
||||
github.com/aws/aws-sdk-go/private/protocol/query
|
||||
github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil
|
||||
github.com/aws/aws-sdk-go/private/protocol/query/queryutil
|
||||
# github.com/cockroachdb/cockroach-go v0.0.0-20180212155653-59c0560478b7
|
||||
@@ -136,12 +140,15 @@ github.com/gobuffalo/x/httpx
|
||||
# github.com/gocraft/work v0.5.1
|
||||
github.com/gocraft/work
|
||||
# github.com/golang/protobuf v1.2.0
|
||||
github.com/golang/protobuf/proto
|
||||
github.com/golang/protobuf/ptypes
|
||||
github.com/golang/protobuf/protoc-gen-go/descriptor
|
||||
github.com/golang/protobuf/ptypes/any
|
||||
github.com/golang/protobuf/ptypes/duration
|
||||
github.com/golang/protobuf/ptypes/timestamp
|
||||
github.com/golang/protobuf/ptypes/wrappers
|
||||
github.com/golang/protobuf/proto
|
||||
github.com/golang/protobuf/ptypes/struct
|
||||
github.com/golang/protobuf/ptypes/empty
|
||||
github.com/golang/protobuf/ptypes/duration
|
||||
github.com/golang/protobuf/ptypes/any
|
||||
github.com/golang/protobuf/protoc-gen-go/descriptor
|
||||
github.com/golang/protobuf/ptypes
|
||||
# github.com/gomodule/redigo v2.0.0+incompatible
|
||||
github.com/gomodule/redigo/redis
|
||||
github.com/gomodule/redigo/internal
|
||||
@@ -269,18 +276,19 @@ github.com/unrolled/secure
|
||||
go.opencensus.io/exporter/jaeger
|
||||
go.opencensus.io/plugin/ochttp
|
||||
go.opencensus.io/trace
|
||||
go.opencensus.io
|
||||
go.opencensus.io/stats
|
||||
go.opencensus.io/stats/view
|
||||
go.opencensus.io/tag
|
||||
go.opencensus.io/exporter/jaeger/internal/gen-go/jaeger
|
||||
go.opencensus.io/plugin/ochttp/propagation/b3
|
||||
go.opencensus.io/stats
|
||||
go.opencensus.io/trace/propagation
|
||||
go.opencensus.io/internal
|
||||
go.opencensus.io/trace/internal
|
||||
go.opencensus.io/trace/tracestate
|
||||
go.opencensus.io/internal/tagencoding
|
||||
go.opencensus.io/stats/internal
|
||||
go.opencensus.io
|
||||
go.opencensus.io/internal/tagencoding
|
||||
go.opencensus.io/plugin/ocgrpc
|
||||
# golang.org/x/crypto v0.0.0-20180808211826-de0752318171
|
||||
golang.org/x/crypto/bcrypt
|
||||
golang.org/x/crypto/ssh/terminal
|
||||
@@ -300,8 +308,8 @@ golang.org/x/net/http2/hpack
|
||||
golang.org/x/net/internal/timeseries
|
||||
# golang.org/x/oauth2 v0.0.0-20180620175406-ef147856a6dd
|
||||
golang.org/x/oauth2
|
||||
golang.org/x/oauth2/internal
|
||||
golang.org/x/oauth2/google
|
||||
golang.org/x/oauth2/internal
|
||||
golang.org/x/oauth2/jws
|
||||
golang.org/x/oauth2/jwt
|
||||
# golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
|
||||
@@ -319,34 +327,46 @@ golang.org/x/text/unicode/bidi
|
||||
# google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf
|
||||
google.golang.org/api/googleapi
|
||||
google.golang.org/api/iterator
|
||||
google.golang.org/api/support/bundler
|
||||
google.golang.org/api/option
|
||||
google.golang.org/api/support/bundler
|
||||
google.golang.org/api/storage/v1
|
||||
google.golang.org/api/transport/http
|
||||
google.golang.org/api/googleapi/internal/uritemplates
|
||||
google.golang.org/api/transport
|
||||
google.golang.org/api/internal
|
||||
google.golang.org/api/gensupport
|
||||
google.golang.org/api/googleapi/transport
|
||||
google.golang.org/api/transport/grpc
|
||||
# google.golang.org/appengine v1.1.0
|
||||
google.golang.org/appengine
|
||||
google.golang.org/appengine/urlfetch
|
||||
google.golang.org/appengine/cloudsql
|
||||
google.golang.org/appengine
|
||||
google.golang.org/appengine/internal
|
||||
google.golang.org/appengine/internal/urlfetch
|
||||
google.golang.org/appengine/internal/app_identity
|
||||
google.golang.org/appengine/internal/modules
|
||||
google.golang.org/appengine/internal/urlfetch
|
||||
google.golang.org/appengine/socket
|
||||
google.golang.org/appengine/internal/base
|
||||
google.golang.org/appengine/internal/datastore
|
||||
google.golang.org/appengine/internal/log
|
||||
google.golang.org/appengine/internal/remote_api
|
||||
google.golang.org/appengine/internal/socket
|
||||
# google.golang.org/genproto v0.0.0-20180831171423-11092d34479b
|
||||
google.golang.org/genproto/googleapis/iam/v1
|
||||
google.golang.org/genproto/googleapis/rpc/code
|
||||
google.golang.org/genproto/googleapis/api/annotations
|
||||
google.golang.org/genproto/googleapis/api/distribution
|
||||
google.golang.org/genproto/googleapis/api/label
|
||||
google.golang.org/genproto/googleapis/api/metric
|
||||
google.golang.org/genproto/googleapis/api/monitoredres
|
||||
google.golang.org/genproto/googleapis/devtools/cloudtrace/v2
|
||||
google.golang.org/genproto/googleapis/monitoring/v3
|
||||
google.golang.org/genproto/googleapis/rpc/status
|
||||
google.golang.org/genproto/googleapis/iam/v1
|
||||
google.golang.org/genproto/googleapis/api/annotations
|
||||
google.golang.org/genproto/protobuf/field_mask
|
||||
google.golang.org/genproto/googleapis/rpc/code
|
||||
# google.golang.org/grpc v1.14.0
|
||||
google.golang.org/grpc
|
||||
google.golang.org/grpc/codes
|
||||
google.golang.org/grpc/metadata
|
||||
google.golang.org/grpc/status
|
||||
google.golang.org/grpc/balancer
|
||||
google.golang.org/grpc/balancer/roundrobin
|
||||
@@ -362,7 +382,6 @@ google.golang.org/grpc/internal/envconfig
|
||||
google.golang.org/grpc/internal/grpcrand
|
||||
google.golang.org/grpc/internal/transport
|
||||
google.golang.org/grpc/keepalive
|
||||
google.golang.org/grpc/metadata
|
||||
google.golang.org/grpc/naming
|
||||
google.golang.org/grpc/peer
|
||||
google.golang.org/grpc/resolver
|
||||
@@ -370,6 +389,7 @@ google.golang.org/grpc/resolver/dns
|
||||
google.golang.org/grpc/resolver/passthrough
|
||||
google.golang.org/grpc/stats
|
||||
google.golang.org/grpc/tap
|
||||
google.golang.org/grpc/credentials/oauth
|
||||
google.golang.org/grpc/balancer/base
|
||||
# gopkg.in/DataDog/dd-trace-go.v1 v1.3.0
|
||||
gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext
|
||||
|
||||
Reference in New Issue
Block a user