Source File
error_stats_client.go
Belonging Package
cloud.google.com/go/errorreporting/apiv1beta1
package errorreporting
import (
gax
gtransport
clouderrorreportingpb
)
var newErrorStatsClientHook clientHook
type ErrorStatsCallOptions struct {
ListGroupStats []gax.CallOption
ListEvents []gax.CallOption
DeleteEvents []gax.CallOption
}
func () []option.ClientOption {
return []option.ClientOption{
option.WithEndpoint("clouderrorreporting.googleapis.com:443"),
option.WithGRPCDialOption(grpc.WithDisableServiceConfig()),
option.WithScopes(DefaultAuthScopes()...),
option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
grpc.MaxCallRecvMsgSize(math.MaxInt32))),
}
}
func () *ErrorStatsCallOptions {
return &ErrorStatsCallOptions{
ListGroupStats: []gax.CallOption{
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.Unavailable,
codes.DeadlineExceeded,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.30,
})
}),
},
ListEvents: []gax.CallOption{
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.Unavailable,
codes.DeadlineExceeded,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.30,
})
}),
},
DeleteEvents: []gax.CallOption{
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.Unavailable,
codes.DeadlineExceeded,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.30,
})
}),
},
}
}
func ( context.Context, ...option.ClientOption) (*ErrorStatsClient, error) {
:= defaultErrorStatsClientOptions()
if newErrorStatsClientHook != nil {
, := newErrorStatsClientHook(, clientHookParams{})
if != nil {
return nil,
}
= append(, ...)
}
, := checkDisableDeadlines()
if != nil {
return nil,
}
, := gtransport.DialPool(, append(, ...)...)
if != nil {
return nil,
}
:= &ErrorStatsClient{
connPool: ,
disableDeadlines: ,
CallOptions: defaultErrorStatsCallOptions(),
errorStatsClient: clouderrorreportingpb.NewErrorStatsServiceClient(),
}
.setGoogleClientInfo()
return , nil
}
func ( *ErrorStatsClient) () *grpc.ClientConn {
return .connPool.Conn()
}
func ( *ErrorStatsClient) () error {
return .connPool.Close()
}
func ( *ErrorStatsClient) ( ...string) {
:= append([]string{"gl-go", versionGo()}, ...)
= append(, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)
.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(...))
}
func ( *ErrorStatsClient) ( context.Context, *clouderrorreportingpb.ListGroupStatsRequest, ...gax.CallOption) *ErrorGroupStatsIterator {
:= metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "project_name", url.QueryEscape(.GetProjectName())))
= insertMetadata(, .xGoogMetadata, )
= append(.CallOptions.ListGroupStats[0:len(.CallOptions.ListGroupStats):len(.CallOptions.ListGroupStats)], ...)
:= &ErrorGroupStatsIterator{}
= proto.Clone().(*clouderrorreportingpb.ListGroupStatsRequest)
.InternalFetch = func( int, string) ([]*clouderrorreportingpb.ErrorGroupStats, string, error) {
var *clouderrorreportingpb.ListGroupStatsResponse
.PageToken =
if > math.MaxInt32 {
.PageSize = math.MaxInt32
} else {
.PageSize = int32()
}
:= gax.Invoke(, func( context.Context, gax.CallSettings) error {
var error
, = .errorStatsClient.ListGroupStats(, , .GRPC...)
return
}, ...)
if != nil {
return nil, "",
}
.Response =
return .GetErrorGroupStats(), .GetNextPageToken(), nil
}
:= func( int, string) (string, error) {
, , := .InternalFetch(, )
if != nil {
return "",
}
.items = append(.items, ...)
return , nil
}
.pageInfo, .nextFunc = iterator.NewPageInfo(, .bufLen, .takeBuf)
.pageInfo.MaxSize = int(.GetPageSize())
.pageInfo.Token = .GetPageToken()
return
}
func ( *ErrorStatsClient) ( context.Context, *clouderrorreportingpb.ListEventsRequest, ...gax.CallOption) *ErrorEventIterator {
:= metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "project_name", url.QueryEscape(.GetProjectName())))
= insertMetadata(, .xGoogMetadata, )
= append(.CallOptions.ListEvents[0:len(.CallOptions.ListEvents):len(.CallOptions.ListEvents)], ...)
:= &ErrorEventIterator{}
= proto.Clone().(*clouderrorreportingpb.ListEventsRequest)
.InternalFetch = func( int, string) ([]*clouderrorreportingpb.ErrorEvent, string, error) {
var *clouderrorreportingpb.ListEventsResponse
.PageToken =
if > math.MaxInt32 {
.PageSize = math.MaxInt32
} else {
.PageSize = int32()
}
:= gax.Invoke(, func( context.Context, gax.CallSettings) error {
var error
, = .errorStatsClient.ListEvents(, , .GRPC...)
return
}, ...)
if != nil {
return nil, "",
}
.Response =
return .GetErrorEvents(), .GetNextPageToken(), nil
}
:= func( int, string) (string, error) {
, , := .InternalFetch(, )
if != nil {
return "",
}
.items = append(.items, ...)
return , nil
}
.pageInfo, .nextFunc = iterator.NewPageInfo(, .bufLen, .takeBuf)
.pageInfo.MaxSize = int(.GetPageSize())
.pageInfo.Token = .GetPageToken()
return
}
func ( *ErrorStatsClient) ( context.Context, *clouderrorreportingpb.DeleteEventsRequest, ...gax.CallOption) (*clouderrorreportingpb.DeleteEventsResponse, error) {
if , := .Deadline(); ! && !.disableDeadlines {
, := context.WithTimeout(, 600000*time.Millisecond)
defer ()
=
}
:= metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "project_name", url.QueryEscape(.GetProjectName())))
= insertMetadata(, .xGoogMetadata, )
= append(.CallOptions.DeleteEvents[0:len(.CallOptions.DeleteEvents):len(.CallOptions.DeleteEvents)], ...)
var *clouderrorreportingpb.DeleteEventsResponse
:= gax.Invoke(, func( context.Context, gax.CallSettings) error {
var error
, = .errorStatsClient.DeleteEvents(, , .GRPC...)
return
}, ...)
if != nil {
return nil,
}
return , nil
}
type ErrorEventIterator struct {
items []*clouderrorreportingpb.ErrorEvent
pageInfo *iterator.PageInfo
nextFunc func() error
Response interface{}
InternalFetch func(pageSize int, pageToken string) (results []*clouderrorreportingpb.ErrorEvent, nextPageToken string, err error)
}
func ( *ErrorEventIterator) () *iterator.PageInfo {
return .pageInfo
}
func ( *ErrorEventIterator) () (*clouderrorreportingpb.ErrorEvent, error) {
var *clouderrorreportingpb.ErrorEvent
if := .nextFunc(); != nil {
return ,
}
= .items[0]
.items = .items[1:]
return , nil
}
func ( *ErrorEventIterator) () int {
return len(.items)
}
func ( *ErrorEventIterator) () interface{} {
:= .items
.items = nil
return
}
type ErrorGroupStatsIterator struct {
items []*clouderrorreportingpb.ErrorGroupStats
pageInfo *iterator.PageInfo
nextFunc func() error
Response interface{}
InternalFetch func(pageSize int, pageToken string) (results []*clouderrorreportingpb.ErrorGroupStats, nextPageToken string, err error)
}
func ( *ErrorGroupStatsIterator) () *iterator.PageInfo {
return .pageInfo
}
func ( *ErrorGroupStatsIterator) () (*clouderrorreportingpb.ErrorGroupStats, error) {
var *clouderrorreportingpb.ErrorGroupStats
if := .nextFunc(); != nil {
return ,
}
= .items[0]
.items = .items[1:]
return , nil
}
func ( *ErrorGroupStatsIterator) () int {
return len(.items)
}
func ( *ErrorGroupStatsIterator) () interface{} {
:= .items
.items = nil
return
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |