Update dependencies

This commit is contained in:
Alexander Neumann
2017-09-13 14:09:48 +02:00
parent f3b49987f8
commit fda563d606
926 changed files with 189726 additions and 98666 deletions

View File

@@ -31,11 +31,6 @@ import (
"google.golang.org/grpc/codes"
)
var (
configProjectPathTemplate = gax.MustCompilePathTemplate("projects/{project}")
configSinkPathTemplate = gax.MustCompilePathTemplate("projects/{project}/sinks/{sink}")
)
// ConfigCallOptions contains the retry settings for each method of ConfigClient.
type ConfigCallOptions struct {
ListSinks []gax.CallOption
@@ -133,25 +128,20 @@ func (c *ConfigClient) SetGoogleClientInfo(keyval ...string) {
// ConfigProjectPath returns the path for the project resource.
func ConfigProjectPath(project string) string {
path, err := configProjectPathTemplate.Render(map[string]string{
"project": project,
})
if err != nil {
panic(err)
}
return path
return "" +
"projects/" +
project +
""
}
// ConfigSinkPath returns the path for the sink resource.
func ConfigSinkPath(project, sink string) string {
path, err := configSinkPathTemplate.Render(map[string]string{
"project": project,
"sink": sink,
})
if err != nil {
panic(err)
}
return path
return "" +
"projects/" +
project +
"/sinks/" +
sink +
""
}
// ListSinks lists sinks.
@@ -208,7 +198,7 @@ func (c *ConfigClient) GetSink(ctx context.Context, req *loggingpb.GetSinkReques
// CreateSink creates a sink that exports specified log entries to a destination. The
// export of newly-ingested log entries begins immediately, unless the current
// time is outside the sink's start and end times or the sink's
// `writer_identity` is not permitted to write to the destination. A sink can
// writer_identity is not permitted to write to the destination. A sink can
// export log entries only from the resource owning the sink.
func (c *ConfigClient) CreateSink(ctx context.Context, req *loggingpb.CreateSinkRequest, opts ...gax.CallOption) (*loggingpb.LogSink, error) {
ctx = insertXGoog(ctx, c.xGoogHeader)
@@ -227,12 +217,12 @@ func (c *ConfigClient) CreateSink(ctx context.Context, req *loggingpb.CreateSink
// UpdateSink updates a sink. If the named sink doesn't exist, then this method is
// identical to
// [sinks.create](/logging/docs/api/reference/rest/v2/projects.sinks/create).
// sinks.create (at /logging/docs/api/reference/rest/v2/projects.sinks/create).
// If the named sink does exist, then this method replaces the following
// fields in the existing sink with values from the new sink: `destination`,
// `filter`, `output_version_format`, `start_time`, and `end_time`.
// The updated filter might also have a new `writer_identity`; see the
// `unique_writer_identity` field.
// fields in the existing sink with values from the new sink: destination,
// filter, output_version_format, start_time, and end_time.
// The updated filter might also have a new writer_identity; see the
// unique_writer_identity field.
func (c *ConfigClient) UpdateSink(ctx context.Context, req *loggingpb.UpdateSinkRequest, opts ...gax.CallOption) (*loggingpb.LogSink, error) {
ctx = insertXGoog(ctx, c.xGoogHeader)
opts = append(c.CallOptions.UpdateSink[0:len(c.CallOptions.UpdateSink):len(c.CallOptions.UpdateSink)], opts...)
@@ -248,7 +238,7 @@ func (c *ConfigClient) UpdateSink(ctx context.Context, req *loggingpb.UpdateSink
return resp, nil
}
// DeleteSink deletes a sink. If the sink has a unique `writer_identity`, then that
// DeleteSink deletes a sink. If the sink has a unique writer_identity, then that
// service account is also deleted.
func (c *ConfigClient) DeleteSink(ctx context.Context, req *loggingpb.DeleteSinkRequest, opts ...gax.CallOption) error {
ctx = insertXGoog(ctx, c.xGoogHeader)

View File

@@ -35,8 +35,7 @@ func insertXGoog(ctx context.Context, val []string) context.Context {
return metadata.NewOutgoingContext(ctx, md)
}
// DefaultAuthScopes reports the authentication scopes required
// by this package.
// 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",

View File

@@ -32,11 +32,6 @@ import (
"google.golang.org/grpc/codes"
)
var (
loggingProjectPathTemplate = gax.MustCompilePathTemplate("projects/{project}")
loggingLogPathTemplate = gax.MustCompilePathTemplate("projects/{project}/logs/{log}")
)
// CallOptions contains the retry settings for each method of Client.
type CallOptions struct {
DeleteLog []gax.CallOption
@@ -146,25 +141,20 @@ func (c *Client) SetGoogleClientInfo(keyval ...string) {
// ProjectPath returns the path for the project resource.
func ProjectPath(project string) string {
path, err := loggingProjectPathTemplate.Render(map[string]string{
"project": project,
})
if err != nil {
panic(err)
}
return path
return "" +
"projects/" +
project +
""
}
// LogPath returns the path for the log resource.
func LogPath(project, log string) string {
path, err := loggingLogPathTemplate.Render(map[string]string{
"project": project,
"log": log,
})
if err != nil {
panic(err)
}
return path
return "" +
"projects/" +
project +
"/logs/" +
log +
""
}
// DeleteLog deletes all the log entries in a log.
@@ -200,7 +190,7 @@ func (c *Client) WriteLogEntries(ctx context.Context, req *loggingpb.WriteLogEnt
// ListLogEntries lists log entries. Use this method to retrieve log entries from
// Stackdriver Logging. For ways to export log entries, see
// [Exporting Logs](/logging/docs/export).
// Exporting Logs (at /logging/docs/export).
func (c *Client) ListLogEntries(ctx context.Context, req *loggingpb.ListLogEntriesRequest, opts ...gax.CallOption) *LogEntryIterator {
ctx = insertXGoog(ctx, c.xGoogHeader)
opts = append(c.CallOptions.ListLogEntries[0:len(c.CallOptions.ListLogEntries):len(c.CallOptions.ListLogEntries)], opts...)

View File

@@ -31,11 +31,6 @@ import (
"google.golang.org/grpc/codes"
)
var (
metricsProjectPathTemplate = gax.MustCompilePathTemplate("projects/{project}")
metricsMetricPathTemplate = gax.MustCompilePathTemplate("projects/{project}/metrics/{metric}")
)
// MetricsCallOptions contains the retry settings for each method of MetricsClient.
type MetricsCallOptions struct {
ListLogMetrics []gax.CallOption
@@ -132,25 +127,20 @@ func (c *MetricsClient) SetGoogleClientInfo(keyval ...string) {
// MetricsProjectPath returns the path for the project resource.
func MetricsProjectPath(project string) string {
path, err := metricsProjectPathTemplate.Render(map[string]string{
"project": project,
})
if err != nil {
panic(err)
}
return path
return "" +
"projects/" +
project +
""
}
// MetricsMetricPath returns the path for the metric resource.
func MetricsMetricPath(project, metric string) string {
path, err := metricsMetricPathTemplate.Render(map[string]string{
"project": project,
"metric": metric,
})
if err != nil {
panic(err)
}
return path
return "" +
"projects/" +
project +
"/metrics/" +
metric +
""
}
// ListLogMetrics lists logs-based metrics.

View File

@@ -46,7 +46,9 @@ import (
logtypepb "google.golang.org/genproto/googleapis/logging/type"
logpb "google.golang.org/genproto/googleapis/logging/v2"
"google.golang.org/grpc/codes"
// Import the following so EntryIterator can unmarshal log protos.
_ "google.golang.org/genproto/googleapis/appengine/logging/v1"
_ "google.golang.org/genproto/googleapis/cloud/audit"
)

View File

@@ -87,8 +87,7 @@ func (c *Client) Sink(ctx context.Context, sinkID string) (*Sink, error) {
return fromLogSink(ls), nil
}
// UpdateSink updates an existing Sink, or creates a new one if the Sink doesn't exist.
// Requires AdminScope.
// UpdateSink updates an existing Sink. Requires AdminScope.
func (c *Client) UpdateSink(ctx context.Context, sink *Sink) (*Sink, error) {
ls, err := c.sClient.UpdateSink(ctx, &logpb.UpdateSinkRequest{
SinkName: c.sinkPath(sink.ID),

View File

@@ -152,7 +152,9 @@ func TestUpdateSink(t *testing.T) {
Filter: testFilter,
}
// Updating a non-existent sink creates a new one.
if _, err := client.CreateSink(ctx, sink); err != nil {
t.Fatal(err)
}
got, err := client.UpdateSink(ctx, sink)
if err != nil {
t.Fatal(err)

View File

@@ -86,7 +86,11 @@ var now = time.Now
// ErrOverflow signals that the number of buffered entries for a Logger
// exceeds its BufferLimit.
var ErrOverflow = errors.New("logging: log entry overflowed buffer limits")
var ErrOverflow = bundler.ErrOverflow
// ErrOversizedEntry signals that an entry's size exceeds the maximum number of
// bytes that will be sent in a single call to the logging service.
var ErrOversizedEntry = bundler.ErrOversizedItem
// Client is a Logging client. A Client is associated with a single Cloud project.
type Client struct {
@@ -331,10 +335,10 @@ type entryByteThreshold int
func (e entryByteThreshold) set(l *Logger) { l.bundler.BundleByteThreshold = int(e) }
// EntryByteLimit is the maximum number of bytes of entries that will be sent
// in a single call to the logging service. This option limits the size of a
// single RPC payload, to account for network or service issues with large
// RPCs. If EntryByteLimit is smaller than EntryByteThreshold, the latter has
// no effect.
// in a single call to the logging service. ErrOversizedEntry is returned if an
// entry exceeds EntryByteLimit. This option limits the size of a single RPC
// payload, to account for network or service issues with large RPCs. If
// EntryByteLimit is smaller than EntryByteThreshold, the latter has no effect.
// The default is zero, meaning there is no limit.
func EntryByteLimit(n int) LoggerOption { return entryByteLimit(n) }