Update dependencies

Among others, this updates minio-go, so that the new "eu-west-3" zone
for AWS is supported.
This commit is contained in:
Alexander Neumann
2018-01-23 19:40:42 +01:00
parent b63de7c798
commit 2b39f9f4b2
3435 changed files with 1318042 additions and 315692 deletions

View File

@@ -1,10 +1,10 @@
// Copyright 2017, Google Inc. All rights reserved.
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
// 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,
@@ -21,6 +21,7 @@ import (
)
import (
"fmt"
"strconv"
"testing"
"time"
@@ -31,6 +32,7 @@ import (
"google.golang.org/api/option"
)
var _ = fmt.Sprintf
var _ = iterator.Done
var _ = strconv.FormatUint
var _ = time.Now

View File

@@ -1,10 +1,10 @@
// Copyright 2017, Google Inc. All rights reserved.
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
// 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,
@@ -17,13 +17,15 @@
// 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 be subject to changes.
// NOTE: This package is in alpha. It is not stable, and is likely to change.
//
// Send and retrieve trace data from Stackdriver Trace. Data is generated and
// available by default for all App Engine applications. Data from other
// applications can be written to Stackdriver Trace for display, reporting,
// and
// analysis.
// 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.
//
// Use the client at cloud.google.com/go/trace in preference to this.
package trace // import "cloud.google.com/go/trace/apiv1"
import (

View File

@@ -1,10 +1,10 @@
// Copyright 2017, Google Inc. All rights reserved.
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
// 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,
@@ -126,6 +126,127 @@ func TestMain(m *testing.M) {
os.Exit(m.Run())
}
func TestTraceServicePatchTraces(t *testing.T) {
var expectedResponse *emptypb.Empty = &emptypb.Empty{}
mockTrace.err = nil
mockTrace.reqs = nil
mockTrace.resps = append(mockTrace.resps[:0], expectedResponse)
var projectId string = "projectId-1969970175"
var traces *cloudtracepb.Traces = &cloudtracepb.Traces{}
var request = &cloudtracepb.PatchTracesRequest{
ProjectId: projectId,
Traces: traces,
}
c, err := NewClient(context.Background(), clientOpt)
if err != nil {
t.Fatal(err)
}
err = c.PatchTraces(context.Background(), request)
if err != nil {
t.Fatal(err)
}
if want, got := request, mockTrace.reqs[0]; !proto.Equal(want, got) {
t.Errorf("wrong request %q, want %q", got, want)
}
}
func TestTraceServicePatchTracesError(t *testing.T) {
errCode := codes.PermissionDenied
mockTrace.err = gstatus.Error(errCode, "test error")
var projectId string = "projectId-1969970175"
var traces *cloudtracepb.Traces = &cloudtracepb.Traces{}
var request = &cloudtracepb.PatchTracesRequest{
ProjectId: projectId,
Traces: traces,
}
c, err := NewClient(context.Background(), clientOpt)
if err != nil {
t.Fatal(err)
}
err = c.PatchTraces(context.Background(), request)
if st, ok := gstatus.FromError(err); !ok {
t.Errorf("got error %v, expected grpc error", err)
} else if c := st.Code(); c != errCode {
t.Errorf("got error code %q, want %q", c, errCode)
}
}
func TestTraceServiceGetTrace(t *testing.T) {
var projectId2 string = "projectId2939242356"
var traceId2 string = "traceId2987826376"
var expectedResponse = &cloudtracepb.Trace{
ProjectId: projectId2,
TraceId: traceId2,
}
mockTrace.err = nil
mockTrace.reqs = nil
mockTrace.resps = append(mockTrace.resps[:0], expectedResponse)
var projectId string = "projectId-1969970175"
var traceId string = "traceId1270300245"
var request = &cloudtracepb.GetTraceRequest{
ProjectId: projectId,
TraceId: traceId,
}
c, err := NewClient(context.Background(), clientOpt)
if err != nil {
t.Fatal(err)
}
resp, err := c.GetTrace(context.Background(), request)
if err != nil {
t.Fatal(err)
}
if want, got := request, mockTrace.reqs[0]; !proto.Equal(want, got) {
t.Errorf("wrong request %q, want %q", got, want)
}
if want, got := expectedResponse, resp; !proto.Equal(want, got) {
t.Errorf("wrong response %q, want %q)", got, want)
}
}
func TestTraceServiceGetTraceError(t *testing.T) {
errCode := codes.PermissionDenied
mockTrace.err = gstatus.Error(errCode, "test error")
var projectId string = "projectId-1969970175"
var traceId string = "traceId1270300245"
var request = &cloudtracepb.GetTraceRequest{
ProjectId: projectId,
TraceId: traceId,
}
c, err := NewClient(context.Background(), clientOpt)
if err != nil {
t.Fatal(err)
}
resp, err := c.GetTrace(context.Background(), request)
if st, ok := gstatus.FromError(err); !ok {
t.Errorf("got error %v, expected grpc error", err)
} else if c := st.Code(); c != errCode {
t.Errorf("got error code %q, want %q", c, errCode)
}
_ = resp
}
func TestTraceServiceListTraces(t *testing.T) {
var nextPageToken string = ""
var tracesElement *cloudtracepb.Trace = &cloudtracepb.Trace{}
@@ -198,124 +319,3 @@ func TestTraceServiceListTracesError(t *testing.T) {
}
_ = resp
}
func TestTraceServiceGetTrace(t *testing.T) {
var projectId2 string = "projectId2939242356"
var traceId2 string = "traceId2987826376"
var expectedResponse = &cloudtracepb.Trace{
ProjectId: projectId2,
TraceId: traceId2,
}
mockTrace.err = nil
mockTrace.reqs = nil
mockTrace.resps = append(mockTrace.resps[:0], expectedResponse)
var projectId string = "projectId-1969970175"
var traceId string = "traceId1270300245"
var request = &cloudtracepb.GetTraceRequest{
ProjectId: projectId,
TraceId: traceId,
}
c, err := NewClient(context.Background(), clientOpt)
if err != nil {
t.Fatal(err)
}
resp, err := c.GetTrace(context.Background(), request)
if err != nil {
t.Fatal(err)
}
if want, got := request, mockTrace.reqs[0]; !proto.Equal(want, got) {
t.Errorf("wrong request %q, want %q", got, want)
}
if want, got := expectedResponse, resp; !proto.Equal(want, got) {
t.Errorf("wrong response %q, want %q)", got, want)
}
}
func TestTraceServiceGetTraceError(t *testing.T) {
errCode := codes.PermissionDenied
mockTrace.err = gstatus.Error(errCode, "test error")
var projectId string = "projectId-1969970175"
var traceId string = "traceId1270300245"
var request = &cloudtracepb.GetTraceRequest{
ProjectId: projectId,
TraceId: traceId,
}
c, err := NewClient(context.Background(), clientOpt)
if err != nil {
t.Fatal(err)
}
resp, err := c.GetTrace(context.Background(), request)
if st, ok := gstatus.FromError(err); !ok {
t.Errorf("got error %v, expected grpc error", err)
} else if c := st.Code(); c != errCode {
t.Errorf("got error code %q, want %q", c, errCode)
}
_ = resp
}
func TestTraceServicePatchTraces(t *testing.T) {
var expectedResponse *emptypb.Empty = &emptypb.Empty{}
mockTrace.err = nil
mockTrace.reqs = nil
mockTrace.resps = append(mockTrace.resps[:0], expectedResponse)
var projectId string = "projectId-1969970175"
var traces *cloudtracepb.Traces = &cloudtracepb.Traces{}
var request = &cloudtracepb.PatchTracesRequest{
ProjectId: projectId,
Traces: traces,
}
c, err := NewClient(context.Background(), clientOpt)
if err != nil {
t.Fatal(err)
}
err = c.PatchTraces(context.Background(), request)
if err != nil {
t.Fatal(err)
}
if want, got := request, mockTrace.reqs[0]; !proto.Equal(want, got) {
t.Errorf("wrong request %q, want %q", got, want)
}
}
func TestTraceServicePatchTracesError(t *testing.T) {
errCode := codes.PermissionDenied
mockTrace.err = gstatus.Error(errCode, "test error")
var projectId string = "projectId-1969970175"
var traces *cloudtracepb.Traces = &cloudtracepb.Traces{}
var request = &cloudtracepb.PatchTracesRequest{
ProjectId: projectId,
Traces: traces,
}
c, err := NewClient(context.Background(), clientOpt)
if err != nil {
t.Fatal(err)
}
err = c.PatchTraces(context.Background(), request)
if st, ok := gstatus.FromError(err); !ok {
t.Errorf("got error %v, expected grpc error", err)
} else if c := st.Code(); c != errCode {
t.Errorf("got error code %q, want %q", c, errCode)
}
}

View File

@@ -1,10 +1,10 @@
// Copyright 2017, Google Inc. All rights reserved.
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
// 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,
@@ -34,9 +34,9 @@ import (
// CallOptions contains the retry settings for each method of Client.
type CallOptions struct {
ListTraces []gax.CallOption
GetTrace []gax.CallOption
PatchTraces []gax.CallOption
GetTrace []gax.CallOption
ListTraces []gax.CallOption
}
func defaultClientOptions() []option.ClientOption {
@@ -62,9 +62,9 @@ func defaultCallOptions() *CallOptions {
},
}
return &CallOptions{
ListTraces: retry[[2]string{"default", "idempotent"}],
PatchTraces: retry[[2]string{"default", "idempotent"}],
GetTrace: retry[[2]string{"default", "idempotent"}],
PatchTraces: retry[[2]string{"write_sink", "non_idempotent"}],
ListTraces: retry[[2]string{"default", "idempotent"}],
}
}
@@ -79,8 +79,8 @@ type Client struct {
// The call options for this service.
CallOptions *CallOptions
// The metadata to be sent with each request.
Metadata metadata.MD
// The x-goog-* metadata to be sent with each request.
xGoogMetadata metadata.MD
}
// NewClient creates a new trace service client.
@@ -101,7 +101,7 @@ func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error
client: cloudtracepb.NewTraceServiceClient(conn),
}
c.setGoogleClientInfo()
c.SetGoogleClientInfo()
return c, nil
}
@@ -116,18 +116,50 @@ func (c *Client) Close() error {
return c.conn.Close()
}
// setGoogleClientInfo sets the name and version of the application in
// 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) {
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.Metadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
}
// PatchTraces sends new traces to Stackdriver Trace or updates existing traces. If the ID
// of a trace that you send matches that of an existing trace, any fields
// in the existing trace and its spans are overwritten by the provided values,
// and any new fields provided are merged with the existing trace data. If the
// ID does not match, a new trace is created.
func (c *Client) PatchTraces(ctx context.Context, req *cloudtracepb.PatchTracesRequest, opts ...gax.CallOption) error {
ctx = insertMetadata(ctx, c.xGoogMetadata)
opts = append(c.CallOptions.PatchTraces[0:len(c.CallOptions.PatchTraces):len(c.CallOptions.PatchTraces)], opts...)
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
var err error
_, err = c.client.PatchTraces(ctx, req, settings.GRPC...)
return err
}, opts...)
return err
}
// GetTrace gets a single trace by its ID.
func (c *Client) GetTrace(ctx context.Context, req *cloudtracepb.GetTraceRequest, opts ...gax.CallOption) (*cloudtracepb.Trace, error) {
ctx = insertMetadata(ctx, c.xGoogMetadata)
opts = append(c.CallOptions.GetTrace[0:len(c.CallOptions.GetTrace):len(c.CallOptions.GetTrace)], opts...)
var resp *cloudtracepb.Trace
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
var err error
resp, err = c.client.GetTrace(ctx, req, settings.GRPC...)
return err
}, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
// ListTraces returns of a list of traces that match the specified filter conditions.
func (c *Client) ListTraces(ctx context.Context, req *cloudtracepb.ListTracesRequest, opts ...gax.CallOption) *TraceIterator {
ctx = insertMetadata(ctx, c.Metadata)
ctx = insertMetadata(ctx, c.xGoogMetadata)
opts = append(c.CallOptions.ListTraces[0:len(c.CallOptions.ListTraces):len(c.CallOptions.ListTraces)], opts...)
it := &TraceIterator{}
it.InternalFetch = func(pageSize int, pageToken string) ([]*cloudtracepb.Trace, string, error) {
@@ -160,38 +192,6 @@ func (c *Client) ListTraces(ctx context.Context, req *cloudtracepb.ListTracesReq
return it
}
// GetTrace gets a single trace by its ID.
func (c *Client) GetTrace(ctx context.Context, req *cloudtracepb.GetTraceRequest, opts ...gax.CallOption) (*cloudtracepb.Trace, error) {
ctx = insertMetadata(ctx, c.Metadata)
opts = append(c.CallOptions.GetTrace[0:len(c.CallOptions.GetTrace):len(c.CallOptions.GetTrace)], opts...)
var resp *cloudtracepb.Trace
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
var err error
resp, err = c.client.GetTrace(ctx, req, settings.GRPC...)
return err
}, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
// PatchTraces sends new traces to Stackdriver Trace or updates existing traces. If the ID
// of a trace that you send matches that of an existing trace, any fields
// in the existing trace and its spans are overwritten by the provided values,
// and any new fields provided are merged with the existing trace data. If the
// ID does not match, a new trace is created.
func (c *Client) PatchTraces(ctx context.Context, req *cloudtracepb.PatchTracesRequest, opts ...gax.CallOption) error {
ctx = insertMetadata(ctx, c.Metadata)
opts = append(c.CallOptions.PatchTraces[0:len(c.CallOptions.PatchTraces):len(c.CallOptions.PatchTraces)], opts...)
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
var err error
_, err = c.client.PatchTraces(ctx, req, settings.GRPC...)
return err
}, opts...)
return err
}
// TraceIterator manages a stream of *cloudtracepb.Trace.
type TraceIterator struct {
items []*cloudtracepb.Trace

View File

@@ -1,10 +1,10 @@
// Copyright 2017, Google Inc. All rights reserved.
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
// 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,
@@ -33,6 +33,40 @@ func ExampleNewClient() {
_ = c
}
func ExampleClient_PatchTraces() {
ctx := context.Background()
c, err := trace.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudtracepb.PatchTracesRequest{
// TODO: Fill request struct fields.
}
err = c.PatchTraces(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func ExampleClient_GetTrace() {
ctx := context.Background()
c, err := trace.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudtracepb.GetTraceRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetTrace(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_ListTraces() {
ctx := context.Background()
c, err := trace.NewClient(ctx)
@@ -41,7 +75,7 @@ func ExampleClient_ListTraces() {
}
req := &cloudtracepb.ListTracesRequest{
// TODO: Fill request struct fields.
// TODO: Fill request struct fields.
}
it := c.ListTraces(ctx, req)
for {
@@ -56,37 +90,3 @@ func ExampleClient_ListTraces() {
_ = resp
}
}
func ExampleClient_GetTrace() {
ctx := context.Background()
c, err := trace.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudtracepb.GetTraceRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetTrace(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_PatchTraces() {
ctx := context.Background()
c, err := trace.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudtracepb.PatchTracesRequest{
// TODO: Fill request struct fields.
}
err = c.PatchTraces(ctx, req)
if err != nil {
// TODO: Handle error.
}
}