Adding upstream version 1.34.4.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
e393c3af3f
commit
4978089aab
4963 changed files with 677545 additions and 0 deletions
45
plugins/outputs/cloud_pubsub/topic_gcp.go
Normal file
45
plugins/outputs/cloud_pubsub/topic_gcp.go
Normal file
|
@ -0,0 +1,45 @@
|
|||
package cloud_pubsub
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"cloud.google.com/go/pubsub"
|
||||
)
|
||||
|
||||
type (
|
||||
topic interface {
|
||||
ID() string
|
||||
Stop()
|
||||
Publish(ctx context.Context, msg *pubsub.Message) publishResult
|
||||
PublishSettings() pubsub.PublishSettings
|
||||
SetPublishSettings(settings pubsub.PublishSettings)
|
||||
}
|
||||
|
||||
publishResult interface {
|
||||
Get(ctx context.Context) (string, error)
|
||||
}
|
||||
|
||||
topicWrapper struct {
|
||||
topic *pubsub.Topic
|
||||
}
|
||||
)
|
||||
|
||||
func (tw *topicWrapper) ID() string {
|
||||
return tw.topic.ID()
|
||||
}
|
||||
|
||||
func (tw *topicWrapper) Stop() {
|
||||
tw.topic.Stop()
|
||||
}
|
||||
|
||||
func (tw *topicWrapper) Publish(ctx context.Context, msg *pubsub.Message) publishResult {
|
||||
return tw.topic.Publish(ctx, msg)
|
||||
}
|
||||
|
||||
func (tw *topicWrapper) PublishSettings() pubsub.PublishSettings {
|
||||
return tw.topic.PublishSettings
|
||||
}
|
||||
|
||||
func (tw *topicWrapper) SetPublishSettings(settings pubsub.PublishSettings) {
|
||||
tw.topic.PublishSettings = settings
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue