mirror of
https://github.com/restic/restic.git
synced 2026-05-27 04:25:22 +00:00
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:
Generated
Vendored
+5
-3
@@ -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
|
||||
@@ -53,7 +55,7 @@ func TestReportErrorsServiceSmoke(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
var formattedProjectName string = ReportErrorsProjectPath(projectId)
|
||||
var formattedProjectName string = fmt.Sprintf("projects/%s", projectId)
|
||||
var message string = "[MESSAGE]"
|
||||
var service string = "[SERVICE]"
|
||||
var serviceContext = &clouderrorreportingpb.ServiceContext{
|
||||
|
||||
+3
-3
@@ -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,7 +17,7 @@
|
||||
// Package errorreporting is an auto-generated package for the
|
||||
// Stackdriver Error Reporting 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.
|
||||
//
|
||||
// Stackdriver Error Reporting groups and counts similar errors from cloud
|
||||
// services. The Stackdriver Error Reporting API provides a way to report new
|
||||
|
||||
+7
-17
@@ -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,
|
||||
@@ -75,8 +75,8 @@ type ErrorGroupClient struct {
|
||||
// The call options for this service.
|
||||
CallOptions *ErrorGroupCallOptions
|
||||
|
||||
// The metadata to be sent with each request.
|
||||
Metadata metadata.MD
|
||||
// The x-goog-* metadata to be sent with each request.
|
||||
xGoogMetadata metadata.MD
|
||||
}
|
||||
|
||||
// NewErrorGroupClient creates a new error group service client.
|
||||
@@ -114,22 +114,12 @@ func (c *ErrorGroupClient) Close() error {
|
||||
func (c *ErrorGroupClient) 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...))
|
||||
}
|
||||
|
||||
// ErrorGroupGroupPath returns the path for the group resource.
|
||||
func ErrorGroupGroupPath(project, group string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
"/groups/" +
|
||||
group +
|
||||
""
|
||||
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
||||
// GetGroup get the specified group.
|
||||
func (c *ErrorGroupClient) GetGroup(ctx context.Context, req *clouderrorreportingpb.GetGroupRequest, opts ...gax.CallOption) (*clouderrorreportingpb.ErrorGroup, error) {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.GetGroup[0:len(c.CallOptions.GetGroup):len(c.CallOptions.GetGroup)], opts...)
|
||||
var resp *clouderrorreportingpb.ErrorGroup
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
@@ -146,7 +136,7 @@ func (c *ErrorGroupClient) GetGroup(ctx context.Context, req *clouderrorreportin
|
||||
// UpdateGroup replace the data for the specified group.
|
||||
// Fails if the group does not exist.
|
||||
func (c *ErrorGroupClient) UpdateGroup(ctx context.Context, req *clouderrorreportingpb.UpdateGroupRequest, opts ...gax.CallOption) (*clouderrorreportingpb.ErrorGroup, error) {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.UpdateGroup[0:len(c.CallOptions.UpdateGroup):len(c.CallOptions.UpdateGroup)], opts...)
|
||||
var resp *clouderrorreportingpb.ErrorGroup
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
|
||||
Generated
Vendored
+4
-4
@@ -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,
|
||||
@@ -40,7 +40,7 @@ func ExampleErrorGroupClient_GetGroup() {
|
||||
}
|
||||
|
||||
req := &clouderrorreportingpb.GetGroupRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.GetGroup(ctx, req)
|
||||
if err != nil {
|
||||
@@ -58,7 +58,7 @@ func ExampleErrorGroupClient_UpdateGroup() {
|
||||
}
|
||||
|
||||
req := &clouderrorreportingpb.UpdateGroupRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.UpdateGroup(ctx, req)
|
||||
if err != nil {
|
||||
|
||||
+8
-16
@@ -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,
|
||||
@@ -79,8 +79,8 @@ type ErrorStatsClient struct {
|
||||
// The call options for this service.
|
||||
CallOptions *ErrorStatsCallOptions
|
||||
|
||||
// The metadata to be sent with each request.
|
||||
Metadata metadata.MD
|
||||
// The x-goog-* metadata to be sent with each request.
|
||||
xGoogMetadata metadata.MD
|
||||
}
|
||||
|
||||
// NewErrorStatsClient creates a new error stats service client.
|
||||
@@ -119,20 +119,12 @@ func (c *ErrorStatsClient) Close() error {
|
||||
func (c *ErrorStatsClient) 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...))
|
||||
}
|
||||
|
||||
// ErrorStatsProjectPath returns the path for the project resource.
|
||||
func ErrorStatsProjectPath(project string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
""
|
||||
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
||||
// ListGroupStats lists the specified groups.
|
||||
func (c *ErrorStatsClient) ListGroupStats(ctx context.Context, req *clouderrorreportingpb.ListGroupStatsRequest, opts ...gax.CallOption) *ErrorGroupStatsIterator {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListGroupStats[0:len(c.CallOptions.ListGroupStats):len(c.CallOptions.ListGroupStats)], opts...)
|
||||
it := &ErrorGroupStatsIterator{}
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*clouderrorreportingpb.ErrorGroupStats, string, error) {
|
||||
@@ -167,7 +159,7 @@ func (c *ErrorStatsClient) ListGroupStats(ctx context.Context, req *clouderrorre
|
||||
|
||||
// ListEvents lists the specified events.
|
||||
func (c *ErrorStatsClient) ListEvents(ctx context.Context, req *clouderrorreportingpb.ListEventsRequest, opts ...gax.CallOption) *ErrorEventIterator {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListEvents[0:len(c.CallOptions.ListEvents):len(c.CallOptions.ListEvents)], opts...)
|
||||
it := &ErrorEventIterator{}
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*clouderrorreportingpb.ErrorEvent, string, error) {
|
||||
@@ -202,7 +194,7 @@ func (c *ErrorStatsClient) ListEvents(ctx context.Context, req *clouderrorreport
|
||||
|
||||
// DeleteEvents deletes all error events of a given project.
|
||||
func (c *ErrorStatsClient) DeleteEvents(ctx context.Context, req *clouderrorreportingpb.DeleteEventsRequest, opts ...gax.CallOption) (*clouderrorreportingpb.DeleteEventsResponse, error) {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.DeleteEvents[0:len(c.CallOptions.DeleteEvents):len(c.CallOptions.DeleteEvents)], opts...)
|
||||
var resp *clouderrorreportingpb.DeleteEventsResponse
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
|
||||
Generated
Vendored
+5
-5
@@ -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,
|
||||
@@ -41,7 +41,7 @@ func ExampleErrorStatsClient_ListGroupStats() {
|
||||
}
|
||||
|
||||
req := &clouderrorreportingpb.ListGroupStatsRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
it := c.ListGroupStats(ctx, req)
|
||||
for {
|
||||
@@ -65,7 +65,7 @@ func ExampleErrorStatsClient_ListEvents() {
|
||||
}
|
||||
|
||||
req := &clouderrorreportingpb.ListEventsRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
it := c.ListEvents(ctx, req)
|
||||
for {
|
||||
@@ -89,7 +89,7 @@ func ExampleErrorStatsClient_DeleteEvents() {
|
||||
}
|
||||
|
||||
req := &clouderrorreportingpb.DeleteEventsRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.DeleteEvents(ctx, req)
|
||||
if err != nil {
|
||||
|
||||
+12
-12
@@ -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,
|
||||
@@ -208,7 +208,7 @@ func TestErrorGroupServiceGetGroup(t *testing.T) {
|
||||
|
||||
mockErrorGroup.resps = append(mockErrorGroup.resps[:0], expectedResponse)
|
||||
|
||||
var formattedGroupName string = ErrorGroupGroupPath("[PROJECT]", "[GROUP]")
|
||||
var formattedGroupName string = fmt.Sprintf("projects/%s/groups/%s", "[PROJECT]", "[GROUP]")
|
||||
var request = &clouderrorreportingpb.GetGroupRequest{
|
||||
GroupName: formattedGroupName,
|
||||
}
|
||||
@@ -237,7 +237,7 @@ func TestErrorGroupServiceGetGroupError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockErrorGroup.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedGroupName string = ErrorGroupGroupPath("[PROJECT]", "[GROUP]")
|
||||
var formattedGroupName string = fmt.Sprintf("projects/%s/groups/%s", "[PROJECT]", "[GROUP]")
|
||||
var request = &clouderrorreportingpb.GetGroupRequest{
|
||||
GroupName: formattedGroupName,
|
||||
}
|
||||
@@ -331,7 +331,7 @@ func TestErrorStatsServiceListGroupStats(t *testing.T) {
|
||||
|
||||
mockErrorStats.resps = append(mockErrorStats.resps[:0], expectedResponse)
|
||||
|
||||
var formattedProjectName string = ErrorStatsProjectPath("[PROJECT]")
|
||||
var formattedProjectName string = fmt.Sprintf("projects/%s", "[PROJECT]")
|
||||
var timeRange *clouderrorreportingpb.QueryTimeRange = &clouderrorreportingpb.QueryTimeRange{}
|
||||
var request = &clouderrorreportingpb.ListGroupStatsRequest{
|
||||
ProjectName: formattedProjectName,
|
||||
@@ -372,7 +372,7 @@ func TestErrorStatsServiceListGroupStatsError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockErrorStats.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedProjectName string = ErrorStatsProjectPath("[PROJECT]")
|
||||
var formattedProjectName string = fmt.Sprintf("projects/%s", "[PROJECT]")
|
||||
var timeRange *clouderrorreportingpb.QueryTimeRange = &clouderrorreportingpb.QueryTimeRange{}
|
||||
var request = &clouderrorreportingpb.ListGroupStatsRequest{
|
||||
ProjectName: formattedProjectName,
|
||||
@@ -407,7 +407,7 @@ func TestErrorStatsServiceListEvents(t *testing.T) {
|
||||
|
||||
mockErrorStats.resps = append(mockErrorStats.resps[:0], expectedResponse)
|
||||
|
||||
var formattedProjectName string = ErrorStatsProjectPath("[PROJECT]")
|
||||
var formattedProjectName string = fmt.Sprintf("projects/%s", "[PROJECT]")
|
||||
var groupId string = "groupId506361563"
|
||||
var request = &clouderrorreportingpb.ListEventsRequest{
|
||||
ProjectName: formattedProjectName,
|
||||
@@ -448,7 +448,7 @@ func TestErrorStatsServiceListEventsError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockErrorStats.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedProjectName string = ErrorStatsProjectPath("[PROJECT]")
|
||||
var formattedProjectName string = fmt.Sprintf("projects/%s", "[PROJECT]")
|
||||
var groupId string = "groupId506361563"
|
||||
var request = &clouderrorreportingpb.ListEventsRequest{
|
||||
ProjectName: formattedProjectName,
|
||||
@@ -477,7 +477,7 @@ func TestErrorStatsServiceDeleteEvents(t *testing.T) {
|
||||
|
||||
mockErrorStats.resps = append(mockErrorStats.resps[:0], expectedResponse)
|
||||
|
||||
var formattedProjectName string = ErrorStatsProjectPath("[PROJECT]")
|
||||
var formattedProjectName string = fmt.Sprintf("projects/%s", "[PROJECT]")
|
||||
var request = &clouderrorreportingpb.DeleteEventsRequest{
|
||||
ProjectName: formattedProjectName,
|
||||
}
|
||||
@@ -506,7 +506,7 @@ func TestErrorStatsServiceDeleteEventsError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockErrorStats.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedProjectName string = ErrorStatsProjectPath("[PROJECT]")
|
||||
var formattedProjectName string = fmt.Sprintf("projects/%s", "[PROJECT]")
|
||||
var request = &clouderrorreportingpb.DeleteEventsRequest{
|
||||
ProjectName: formattedProjectName,
|
||||
}
|
||||
@@ -533,7 +533,7 @@ func TestReportErrorsServiceReportErrorEvent(t *testing.T) {
|
||||
|
||||
mockReportErrors.resps = append(mockReportErrors.resps[:0], expectedResponse)
|
||||
|
||||
var formattedProjectName string = ReportErrorsProjectPath("[PROJECT]")
|
||||
var formattedProjectName string = fmt.Sprintf("projects/%s", "[PROJECT]")
|
||||
var event *clouderrorreportingpb.ReportedErrorEvent = &clouderrorreportingpb.ReportedErrorEvent{}
|
||||
var request = &clouderrorreportingpb.ReportErrorEventRequest{
|
||||
ProjectName: formattedProjectName,
|
||||
@@ -564,7 +564,7 @@ func TestReportErrorsServiceReportErrorEventError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockReportErrors.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedProjectName string = ReportErrorsProjectPath("[PROJECT]")
|
||||
var formattedProjectName string = fmt.Sprintf("projects/%s", "[PROJECT]")
|
||||
var event *clouderrorreportingpb.ReportedErrorEvent = &clouderrorreportingpb.ReportedErrorEvent{}
|
||||
var request = &clouderrorreportingpb.ReportErrorEventRequest{
|
||||
ProjectName: formattedProjectName,
|
||||
|
||||
+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.
|
||||
|
||||
package errorreporting
|
||||
|
||||
// ResultPath returns the path for the result resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("inspect/results/%s", result)
|
||||
// instead.
|
||||
func ResultPath(result string) string {
|
||||
return "" +
|
||||
"inspect/results/" +
|
||||
result +
|
||||
""
|
||||
}
|
||||
|
||||
// ErrorStatsProjectPath returns the path for the project resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("projects/%s", project)
|
||||
// instead.
|
||||
func ErrorStatsProjectPath(project string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
""
|
||||
}
|
||||
|
||||
// ReportErrorsProjectPath returns the path for the project resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("projects/%s", project)
|
||||
// instead.
|
||||
func ReportErrorsProjectPath(project string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
""
|
||||
}
|
||||
+6
-14
@@ -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,
|
||||
@@ -57,8 +57,8 @@ type ReportErrorsClient struct {
|
||||
// The call options for this service.
|
||||
CallOptions *ReportErrorsCallOptions
|
||||
|
||||
// The metadata to be sent with each request.
|
||||
Metadata metadata.MD
|
||||
// The x-goog-* metadata to be sent with each request.
|
||||
xGoogMetadata metadata.MD
|
||||
}
|
||||
|
||||
// NewReportErrorsClient creates a new report errors service client.
|
||||
@@ -96,15 +96,7 @@ func (c *ReportErrorsClient) Close() error {
|
||||
func (c *ReportErrorsClient) 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...))
|
||||
}
|
||||
|
||||
// ReportErrorsProjectPath returns the path for the project resource.
|
||||
func ReportErrorsProjectPath(project string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
""
|
||||
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
||||
// ReportErrorEvent report an individual error event.
|
||||
@@ -115,7 +107,7 @@ func ReportErrorsProjectPath(project string) string {
|
||||
// for authentication. To use an API key, append it to the URL as the value of
|
||||
// a key parameter. For example:<pre>POST https://clouderrorreporting.googleapis.com/v1beta1/projects/example-project/events:report?key=123ABC456</pre>
|
||||
func (c *ReportErrorsClient) ReportErrorEvent(ctx context.Context, req *clouderrorreportingpb.ReportErrorEventRequest, opts ...gax.CallOption) (*clouderrorreportingpb.ReportErrorEventResponse, error) {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ReportErrorEvent[0:len(c.CallOptions.ReportErrorEvent):len(c.CallOptions.ReportErrorEvent)], opts...)
|
||||
var resp *clouderrorreportingpb.ReportErrorEventResponse
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
|
||||
Generated
Vendored
+3
-3
@@ -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,
|
||||
@@ -40,7 +40,7 @@ func ExampleReportErrorsClient_ReportErrorEvent() {
|
||||
}
|
||||
|
||||
req := &clouderrorreportingpb.ReportErrorEventRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.ReportErrorEvent(ctx, req)
|
||||
if err != nil {
|
||||
|
||||
+18
-7
@@ -61,6 +61,7 @@ type Config struct {
|
||||
type Entry struct {
|
||||
Error error
|
||||
Req *http.Request // if error is associated with a request.
|
||||
Stack []byte // if user does not provide a stack trace, runtime.Stack will be called
|
||||
}
|
||||
|
||||
// Client represents a Google Cloud Error Reporting client.
|
||||
@@ -139,13 +140,21 @@ func (c *Client) Close() error {
|
||||
// Report writes an error report. It doesn't block. Errors in
|
||||
// writing the error report can be handled via Client.OnError.
|
||||
func (c *Client) Report(e Entry) {
|
||||
req := c.makeReportErrorEventRequest(e.Req, e.Error.Error())
|
||||
var stack string
|
||||
if e.Stack != nil {
|
||||
stack = string(e.Stack)
|
||||
}
|
||||
req := c.makeReportErrorEventRequest(e.Req, e.Error.Error(), stack)
|
||||
c.bundler.Add(req, 1)
|
||||
}
|
||||
|
||||
// ReportSync writes an error report. It blocks until the entry is written.
|
||||
func (c *Client) ReportSync(ctx context.Context, e Entry) error {
|
||||
req := c.makeReportErrorEventRequest(e.Req, e.Error.Error())
|
||||
var stack string
|
||||
if e.Stack != nil {
|
||||
stack = string(e.Stack)
|
||||
}
|
||||
req := c.makeReportErrorEventRequest(e.Req, e.Error.Error(), stack)
|
||||
_, err := c.apiClient.ReportErrorEvent(ctx, req)
|
||||
return err
|
||||
}
|
||||
@@ -159,11 +168,13 @@ func (c *Client) Flush() {
|
||||
c.bundler.Flush()
|
||||
}
|
||||
|
||||
func (c *Client) makeReportErrorEventRequest(r *http.Request, msg string) *erpb.ReportErrorEventRequest {
|
||||
// limit the stack trace to 16k.
|
||||
var buf [16 * 1024]byte
|
||||
stack := buf[0:runtime.Stack(buf[:], false)]
|
||||
message := msg + "\n" + chopStack(stack)
|
||||
func (c *Client) makeReportErrorEventRequest(r *http.Request, msg string, stack string) *erpb.ReportErrorEventRequest {
|
||||
if stack == "" {
|
||||
// limit the stack trace to 16k.
|
||||
var buf [16 * 1024]byte
|
||||
stack = chopStack(buf[0:runtime.Stack(buf[:], false)])
|
||||
}
|
||||
message := msg + "\n" + stack
|
||||
|
||||
var errorContext *erpb.ErrorContext
|
||||
if r != nil {
|
||||
|
||||
Reference in New Issue
Block a user