Skip to content

Commit

Permalink
BREAKING: all: regenerate toolkit client
Browse files Browse the repository at this point in the history
BREAK: logging: LoggingProjectPath and LoggingLogPath functions are
renamed ProjectPath and LogPath, respectively.

BREAK: videointelligence: The type VideoIntelligenceClient is renamed
Client.

logging: idempotent RPCs can be retried on INTERNAL error. Fixes googleapis#517.

all: fix iterator examples. Fixes googleapis#657.

Change-Id: I1c69f5e2ae681fb4a5d914cdc5e0d67d8b83c02e
Reviewed-on: https://code-review.googlesource.com/13951
Reviewed-by: kokoro <[email protected]>
Reviewed-by: Jonathan Amsterdam <[email protected]>
  • Loading branch information
pongad committed Jun 21, 2017
1 parent 23179f2 commit d4f8670
Show file tree
Hide file tree
Showing 63 changed files with 663 additions and 479 deletions.
11 changes: 0 additions & 11 deletions debugger/apiv2/controller2_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,6 @@ func defaultController2CallOptions() *Controller2CallOptions {
})
}),
},
{"default", "non_idempotent"}: {
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.3,
})
}),
},
}
return &Controller2CallOptions{
RegisterDebuggee: retry[[2]string{"default", "non_idempotent"}],
Expand Down
11 changes: 0 additions & 11 deletions debugger/apiv2/debugger2_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,6 @@ func defaultDebugger2CallOptions() *Debugger2CallOptions {
})
}),
},
{"default", "non_idempotent"}: {
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.3,
})
}),
},
}
return &Debugger2CallOptions{
SetBreakpoint: retry[[2]string{"default", "non_idempotent"}],
Expand Down
4 changes: 3 additions & 1 deletion debugger/apiv2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// AUTO-GENERATED CODE. DO NOT EDIT.

// Package debugger is an experimental, auto-generated package for the
// debugger API.
// Stackdriver Debugger API.
//
// Examines the call stack and variables of a running application
// without stopping or slowing it down.
Expand All @@ -35,6 +35,8 @@ func insertXGoog(ctx context.Context, val []string) context.Context {
return metadata.NewOutgoingContext(ctx, md)
}

// DefaultAuthScopes reports the authentication scopes required
// by this package.
func DefaultAuthScopes() []string {
return []string{
"https://www.googleapis.com/auth/cloud-platform",
Expand Down
49 changes: 33 additions & 16 deletions debugger/apiv2/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
gstatus "google.golang.org/grpc/status"
)

var _ = io.EOF
Expand Down Expand Up @@ -241,7 +242,7 @@ func TestDebugger2SetBreakpoint(t *testing.T) {

func TestDebugger2SetBreakpointError(t *testing.T) {
errCode := codes.PermissionDenied
mockDebugger2.err = grpc.Errorf(errCode, "test error")
mockDebugger2.err = gstatus.Error(errCode, "test error")

var debuggeeId string = "debuggeeId-997255898"
var breakpoint *clouddebuggerpb.Breakpoint = &clouddebuggerpb.Breakpoint{}
Expand All @@ -259,7 +260,9 @@ func TestDebugger2SetBreakpointError(t *testing.T) {

resp, err := c.SetBreakpoint(context.Background(), request)

if c := grpc.Code(err); c != errCode {
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
Expand Down Expand Up @@ -303,7 +306,7 @@ func TestDebugger2GetBreakpoint(t *testing.T) {

func TestDebugger2GetBreakpointError(t *testing.T) {
errCode := codes.PermissionDenied
mockDebugger2.err = grpc.Errorf(errCode, "test error")
mockDebugger2.err = gstatus.Error(errCode, "test error")

var debuggeeId string = "debuggeeId-997255898"
var breakpointId string = "breakpointId498424873"
Expand All @@ -321,7 +324,9 @@ func TestDebugger2GetBreakpointError(t *testing.T) {

resp, err := c.GetBreakpoint(context.Background(), request)

if c := grpc.Code(err); c != errCode {
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
Expand Down Expand Up @@ -362,7 +367,7 @@ func TestDebugger2DeleteBreakpoint(t *testing.T) {

func TestDebugger2DeleteBreakpointError(t *testing.T) {
errCode := codes.PermissionDenied
mockDebugger2.err = grpc.Errorf(errCode, "test error")
mockDebugger2.err = gstatus.Error(errCode, "test error")

var debuggeeId string = "debuggeeId-997255898"
var breakpointId string = "breakpointId498424873"
Expand All @@ -380,7 +385,9 @@ func TestDebugger2DeleteBreakpointError(t *testing.T) {

err = c.DeleteBreakpoint(context.Background(), request)

if c := grpc.Code(err); c != errCode {
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)
}
}
Expand Down Expand Up @@ -424,7 +431,7 @@ func TestDebugger2ListBreakpoints(t *testing.T) {

func TestDebugger2ListBreakpointsError(t *testing.T) {
errCode := codes.PermissionDenied
mockDebugger2.err = grpc.Errorf(errCode, "test error")
mockDebugger2.err = gstatus.Error(errCode, "test error")

var debuggeeId string = "debuggeeId-997255898"
var clientVersion string = "clientVersion-1506231196"
Expand All @@ -440,7 +447,9 @@ func TestDebugger2ListBreakpointsError(t *testing.T) {

resp, err := c.ListBreakpoints(context.Background(), request)

if c := grpc.Code(err); c != errCode {
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
Expand Down Expand Up @@ -482,7 +491,7 @@ func TestDebugger2ListDebuggees(t *testing.T) {

func TestDebugger2ListDebuggeesError(t *testing.T) {
errCode := codes.PermissionDenied
mockDebugger2.err = grpc.Errorf(errCode, "test error")
mockDebugger2.err = gstatus.Error(errCode, "test error")

var project string = "project-309310695"
var clientVersion string = "clientVersion-1506231196"
Expand All @@ -498,7 +507,9 @@ func TestDebugger2ListDebuggeesError(t *testing.T) {

resp, err := c.ListDebuggees(context.Background(), request)

if c := grpc.Code(err); c != errCode {
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
Expand Down Expand Up @@ -538,7 +549,7 @@ func TestController2RegisterDebuggee(t *testing.T) {

func TestController2RegisterDebuggeeError(t *testing.T) {
errCode := codes.PermissionDenied
mockController2.err = grpc.Errorf(errCode, "test error")
mockController2.err = gstatus.Error(errCode, "test error")

var debuggee *clouddebuggerpb.Debuggee = &clouddebuggerpb.Debuggee{}
var request = &clouddebuggerpb.RegisterDebuggeeRequest{
Expand All @@ -552,7 +563,9 @@ func TestController2RegisterDebuggeeError(t *testing.T) {

resp, err := c.RegisterDebuggee(context.Background(), request)

if c := grpc.Code(err); c != errCode {
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
Expand Down Expand Up @@ -597,7 +610,7 @@ func TestController2ListActiveBreakpoints(t *testing.T) {

func TestController2ListActiveBreakpointsError(t *testing.T) {
errCode := codes.PermissionDenied
mockController2.err = grpc.Errorf(errCode, "test error")
mockController2.err = gstatus.Error(errCode, "test error")

var debuggeeId string = "debuggeeId-997255898"
var request = &clouddebuggerpb.ListActiveBreakpointsRequest{
Expand All @@ -611,7 +624,9 @@ func TestController2ListActiveBreakpointsError(t *testing.T) {

resp, err := c.ListActiveBreakpoints(context.Background(), request)

if c := grpc.Code(err); c != errCode {
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
Expand Down Expand Up @@ -653,7 +668,7 @@ func TestController2UpdateActiveBreakpoint(t *testing.T) {

func TestController2UpdateActiveBreakpointError(t *testing.T) {
errCode := codes.PermissionDenied
mockController2.err = grpc.Errorf(errCode, "test error")
mockController2.err = gstatus.Error(errCode, "test error")

var debuggeeId string = "debuggeeId-997255898"
var breakpoint *clouddebuggerpb.Breakpoint = &clouddebuggerpb.Breakpoint{}
Expand All @@ -669,7 +684,9 @@ func TestController2UpdateActiveBreakpointError(t *testing.T) {

resp, err := c.UpdateActiveBreakpoint(context.Background(), request)

if c := grpc.Code(err); c != errCode {
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
Expand Down
4 changes: 3 additions & 1 deletion errorreporting/apiv1beta1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// AUTO-GENERATED CODE. DO NOT EDIT.

// Package errorreporting is an experimental, auto-generated package for the
// errorreporting API.
// Stackdriver Error Reporting API.
//
// Stackdriver Error Reporting groups and counts similar errors from cloud
// services. The Stackdriver Error Reporting API provides a way to report new
Expand All @@ -34,6 +34,8 @@ func insertXGoog(ctx context.Context, val []string) context.Context {
return metadata.NewOutgoingContext(ctx, md)
}

// DefaultAuthScopes reports the authentication scopes required
// by this package.
func DefaultAuthScopes() []string {
return []string{
"https://www.googleapis.com/auth/cloud-platform",
Expand Down
9 changes: 7 additions & 2 deletions errorreporting/apiv1beta1/error_stats_client_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package errorreporting_test
import (
"cloud.google.com/go/errorreporting/apiv1beta1"
"golang.org/x/net/context"
"google.golang.org/api/iterator"
clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1"
)

Expand All @@ -45,9 +46,11 @@ func ExampleErrorStatsClient_ListGroupStats() {
it := c.ListGroupStats(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
break
}
// TODO: Use resp.
_ = resp
Expand All @@ -67,9 +70,11 @@ func ExampleErrorStatsClient_ListEvents() {
it := c.ListEvents(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
break
}
// TODO: Use resp.
_ = resp
Expand Down
Loading

0 comments on commit d4f8670

Please sign in to comment.