OpenSubscriptionByPath returns a *pubsub.Subscription backed by an existing GCP PubSub subscription. subscriptionPath must be of the form "projects/ /subscriptions/ ". See the package documentation for an example.
(client *raw.Client, subscriptionPath string, opts *SubscriptionOptions)
| 494 | // "projects/<projectID>/subscriptions/<subscription>". |
| 495 | // See the package documentation for an example. |
| 496 | func OpenSubscriptionByPath(client *raw.Client, subscriptionPath string, opts *SubscriptionOptions) (*pubsub.Subscription, error) { |
| 497 | matches := subscriptionPathRE.FindStringSubmatch(subscriptionPath) |
| 498 | if len(matches) != 2 { |
| 499 | return nil, fmt.Errorf("invalid subscriptionPath %q; must match %v", subscriptionPath, subscriptionPathRE) |
| 500 | } |
| 501 | subscriptionName := matches[1] |
| 502 | return OpenSubscription(client, subscriptionName, opts), nil |
| 503 | } |
| 504 | |
| 505 | // openSubscription returns a driver.Subscription. |
| 506 | func openSubscription(subscriber *raw.Subscriber, opts *SubscriptionOptions) *subscription { |