本文整理匯總了Golang中github.com/googleapis/gax-go.Invoke函數的典型用法代碼示例。如果您正苦於以下問題:Golang Invoke函數的具體用法?Golang Invoke怎麽用?Golang Invoke使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Invoke函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ListMonitoredResourceDescriptors
// ListMonitoredResourceDescriptors lists the monitored resource descriptors used by Stackdriver Logging.
func (c *Client) ListMonitoredResourceDescriptors(ctx context.Context, req *loggingpb.ListMonitoredResourceDescriptorsRequest) *MonitoredResourceDescriptorIterator {
md, _ := metadata.FromContext(ctx)
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
it := &MonitoredResourceDescriptorIterator{}
fetch := func(pageSize int, pageToken string) (string, error) {
var resp *loggingpb.ListMonitoredResourceDescriptorsResponse
req.PageToken = pageToken
if pageSize > math.MaxInt32 {
req.PageSize = math.MaxInt32
} else {
req.PageSize = int32(pageSize)
}
err := gax.Invoke(ctx, func(ctx context.Context) error {
var err error
resp, err = c.client.ListMonitoredResourceDescriptors(ctx, req)
return err
}, c.CallOptions.ListMonitoredResourceDescriptors...)
if err != nil {
return "", err
}
it.items = append(it.items, resp.ResourceDescriptors...)
return resp.NextPageToken, nil
}
bufLen := func() int { return len(it.items) }
takeBuf := func() interface{} {
b := it.items
it.items = nil
return b
}
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, bufLen, takeBuf)
return it
}
示例2: ListLogMetrics
// ListLogMetrics lists logs-based metrics.
func (c *Client) ListLogMetrics(ctx context.Context, req *google_logging_v2.ListLogMetricsRequest) *LogMetricIterator {
ctx = metadata.NewContext(ctx, c.metadata)
it := &LogMetricIterator{}
it.apiCall = func() error {
if it.atLastPage {
return Done
}
var resp *google_logging_v2.ListLogMetricsResponse
err := gax.Invoke(ctx, func(ctx context.Context) error {
var err error
req.PageToken = it.nextPageToken
req.PageSize = it.pageSize
resp, err = c.client.ListLogMetrics(ctx, req)
return err
}, c.callOptions["ListLogMetrics"]...)
if err != nil {
return err
}
if resp.NextPageToken == "" {
it.atLastPage = true
} else {
it.nextPageToken = resp.NextPageToken
}
it.items = resp.Metrics
return nil
}
return it
}
示例3: ListSubscriptions
// ListSubscriptions lists matching subscriptions.
func (c *SubscriberClient) ListSubscriptions(ctx context.Context, req *pubsubpb.ListSubscriptionsRequest) *SubscriptionIterator {
md, _ := metadata.FromContext(ctx)
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
it := &SubscriptionIterator{}
it.InternalFetch = func(pageSize int, pageToken string) ([]*pubsubpb.Subscription, string, error) {
var resp *pubsubpb.ListSubscriptionsResponse
req.PageToken = pageToken
if pageSize > math.MaxInt32 {
req.PageSize = math.MaxInt32
} else {
req.PageSize = int32(pageSize)
}
err := gax.Invoke(ctx, func(ctx context.Context) error {
var err error
resp, err = c.subscriberClient.ListSubscriptions(ctx, req)
return err
}, c.CallOptions.ListSubscriptions...)
if err != nil {
return nil, "", err
}
return resp.Subscriptions, resp.NextPageToken, nil
}
fetch := func(pageSize int, pageToken string) (string, error) {
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
if err != nil {
return "", err
}
it.items = append(it.items, items...)
return nextPageToken, nil
}
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
return it
}
示例4: ModifyAckDeadline
// ModifyAckDeadline modifies the ack deadline for a specific message. This method is useful
// to indicate that more time is needed to process a message by the
// subscriber, or to make the message available for redelivery if the
// processing was interrupted.
func (c *SubscriberClient) ModifyAckDeadline(ctx context.Context, req *googleapis_pubsub_v1.ModifyAckDeadlineRequest) error {
ctx = metadata.NewContext(ctx, c.metadata)
err := gax.Invoke(ctx, func(ctx context.Context) error {
var err error
_, err = c.client.ModifyAckDeadline(ctx, req)
return err
}, c.CallOptions.ModifyAckDeadline...)
return err
}
示例5: DeleteSubscription
// DeleteSubscription deletes an existing subscription. All pending messages in the subscription
// are immediately dropped. Calls to `Pull` after deletion will return
// `NOT_FOUND`. After a subscription is deleted, a new one may be created with
// the same name, but the new one has no association with the old
// subscription, or its topic unless the same topic is specified.
func (c *SubscriberClient) DeleteSubscription(ctx context.Context, req *pubsubpb.DeleteSubscriptionRequest) error {
ctx = metadata.NewContext(ctx, c.metadata)
err := gax.Invoke(ctx, func(ctx context.Context) error {
var err error
_, err = c.client.DeleteSubscription(ctx, req)
return err
}, c.CallOptions.DeleteSubscription...)
return err
}
示例6: DeleteLogMetric
// DeleteLogMetric deletes a logs-based metric.
func (c *Client) DeleteLogMetric(ctx context.Context, req *google_logging_v2.DeleteLogMetricRequest) error {
ctx = metadata.NewContext(ctx, c.metadata)
err := gax.Invoke(ctx, func(ctx context.Context) error {
var err error
_, err = c.client.DeleteLogMetric(ctx, req)
return err
}, c.callOptions["DeleteLogMetric"]...)
return err
}
示例7: Acknowledge
// Acknowledge acknowledges the messages associated with the `ack_ids` in the
// `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages
// from the subscription.
//
// Acknowledging a message whose ack deadline has expired may succeed,
// but such a message may be redelivered later. Acknowledging a message more
// than once will not result in an error.
func (c *SubscriberClient) Acknowledge(ctx context.Context, req *pubsubpb.AcknowledgeRequest) error {
ctx = metadata.NewContext(ctx, c.metadata)
err := gax.Invoke(ctx, func(ctx context.Context) error {
var err error
_, err = c.client.Acknowledge(ctx, req)
return err
}, c.CallOptions.Acknowledge...)
return err
}
示例8: DeleteLog
// DeleteLog deletes a log and all its log entries.
// The log will reappear if it receives new entries.
func (c *Client) DeleteLog(ctx context.Context, req *loggingpb.DeleteLogRequest) error {
ctx = metadata.NewContext(ctx, c.metadata)
err := gax.Invoke(ctx, func(ctx context.Context) error {
var err error
_, err = c.client.DeleteLog(ctx, req)
return err
}, c.CallOptions.DeleteLog...)
return err
}
示例9: DeleteTopic
// DeleteTopic deletes the topic with the given name. Returns `NOT_FOUND` if the topic
// does not exist. After a topic is deleted, a new topic may be created with
// the same name; this is an entirely new topic with none of the old
// configuration or subscriptions. Existing subscriptions to this topic are
// not deleted, but their `topic` field is set to `_deleted-topic_`.
func (c *PublisherClient) DeleteTopic(ctx context.Context, req *pubsubpb.DeleteTopicRequest) error {
ctx = metadata.NewContext(ctx, c.metadata)
err := gax.Invoke(ctx, func(ctx context.Context) error {
var err error
_, err = c.client.DeleteTopic(ctx, req)
return err
}, c.CallOptions.DeleteTopic...)
return err
}
示例10: ModifyPushConfig
// ModifyPushConfig modifies the `PushConfig` for a specified subscription.
//
// This may be used to change a push subscription to a pull one (signified by
// an empty `PushConfig`) or vice versa, or change the endpoint URL and other
// attributes of a push subscription. Messages will accumulate for delivery
// continuously through the call regardless of changes to the `PushConfig`.
func (c *SubscriberClient) ModifyPushConfig(ctx context.Context, req *pubsubpb.ModifyPushConfigRequest) error {
ctx = metadata.NewContext(ctx, c.metadata)
err := gax.Invoke(ctx, func(ctx context.Context) error {
var err error
_, err = c.client.ModifyPushConfig(ctx, req)
return err
}, c.CallOptions.ModifyPushConfig...)
return err
}
示例11: DeleteBreakpoint
// DeleteBreakpoint deletes the breakpoint from the debuggee.
func (c *Debugger2Client) DeleteBreakpoint(ctx context.Context, req *clouddebuggerpb.DeleteBreakpointRequest) error {
md, _ := metadata.FromContext(ctx)
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
err := gax.Invoke(ctx, func(ctx context.Context) error {
var err error
_, err = c.debugger2Client.DeleteBreakpoint(ctx, req)
return err
}, c.CallOptions.DeleteBreakpoint...)
return err
}
示例12: ModifyAckDeadline
// ModifyAckDeadline modifies the ack deadline for a specific message. This method is useful
// to indicate that more time is needed to process a message by the
// subscriber, or to make the message available for redelivery if the
// processing was interrupted. Note that this does not modify the
// subscription-level `ackDeadlineSeconds` used for subsequent messages.
func (c *SubscriberClient) ModifyAckDeadline(ctx context.Context, req *pubsubpb.ModifyAckDeadlineRequest) error {
md, _ := metadata.FromContext(ctx)
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
err := gax.Invoke(ctx, func(ctx context.Context) error {
var err error
_, err = c.subscriberClient.ModifyAckDeadline(ctx, req)
return err
}, c.CallOptions.ModifyAckDeadline...)
return err
}
示例13: DeleteLogMetric
// DeleteLogMetric deletes a logs-based metric.
func (c *MetricsClient) DeleteLogMetric(ctx context.Context, req *loggingpb.DeleteLogMetricRequest) error {
md, _ := metadata.FromContext(ctx)
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
err := gax.Invoke(ctx, func(ctx context.Context) error {
var err error
_, err = c.metricsClient.DeleteLogMetric(ctx, req)
return err
}, c.CallOptions.DeleteLogMetric...)
return err
}
示例14: DeleteServiceAccountKey
// DeleteServiceAccountKey deletes a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey].
func (c *IamClient) DeleteServiceAccountKey(ctx context.Context, req *adminpb.DeleteServiceAccountKeyRequest) error {
md, _ := metadata.FromContext(ctx)
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
err := gax.Invoke(ctx, func(ctx context.Context) error {
var err error
_, err = c.iamClient.DeleteServiceAccountKey(ctx, req)
return err
}, c.CallOptions.DeleteServiceAccountKey...)
return err
}
示例15: CreateTimeSeries
// CreateTimeSeries creates or adds data to one or more time series.
// The response is empty if all time series in the request were written.
// If any time series could not be written, a corresponding failure message is
// included in the error response.
func (c *MetricClient) CreateTimeSeries(ctx context.Context, req *monitoringpb.CreateTimeSeriesRequest) error {
md, _ := metadata.FromContext(ctx)
ctx = metadata.NewContext(ctx, metadata.Join(md, c.metadata))
err := gax.Invoke(ctx, func(ctx context.Context) error {
var err error
_, err = c.metricClient.CreateTimeSeries(ctx, req)
return err
}, c.CallOptions.CreateTimeSeries...)
return err
}