コード例 #1
0
ファイル: logging_client.go プロジェクト: rawlingsj/gofabric8
// NewClient creates a new logging service client.
//
// Service for ingesting and querying logs.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
	conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
	if err != nil {
		return nil, err
	}
	c := &Client{
		conn:        conn,
		client:      loggingpb.NewLoggingServiceV2Client(conn),
		CallOptions: defaultCallOptions(),
	}
	c.SetGoogleClientInfo("gax", gax.Version)
	return c, nil
}
コード例 #2
0
ファイル: resources.go プロジェクト: rawlingsj/gofabric8
func (it *ResourceDescriptorIterator) fetch(pageSize int, pageToken string) (string, error) {
	// TODO(jba): Do this a nicer way if the generated code supports one.
	// TODO(jba): If the above TODO can't be done, find a way to pass metadata in the call.
	client := logpb.NewLoggingServiceV2Client(it.client.Connection())
	var res *logpb.ListMonitoredResourceDescriptorsResponse
	err := gax.Invoke(it.ctx, func(ctx context.Context) error {
		it.req.PageSize = trunc32(pageSize)
		it.req.PageToken = pageToken
		var err error
		res, err = client.ListMonitoredResourceDescriptors(ctx, it.req)
		return err
	}, it.client.CallOptions.ListMonitoredResourceDescriptors...)
	if err != nil {
		return "", err
	}
	it.items = append(it.items, res.ResourceDescriptors...)
	return res.NextPageToken, nil
}