Documentation
¶
Overview ¶
package gocloud provides implementations of the whosonfirst/go-webhookd 'Dispatcher' interfaces for GoCloud resources.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBlobDispatcher ¶
NewBlobDispatcher returns a new `BlobDispatcher` instance configured by 'uri' which is expected to be a valid and registered `gocloud.dev/blob.Bucket` URI. The following extra parameters are supported (and removed before the underelying bucket instance is created): - `?dispatch_prefix=_ts_` If present a unix timestamp will be prepended to the final filename.
func NewPubSubDispatcher ¶ added in v1.1.0
NewPubSubDispatcher returns a new `PubSubDispatcher` instance configured by 'uri' which is expected to be a valid and registered `gocloud.dev/pubsub.Topic` URI. The following extra parameters are supported (and removed before the underelying bucket instance is created):
- `?mode={MODE}` An optional string describing how a message body should be processed and delivered to the pubsub topic. Valid options are 'all' which will deliver the entire message body in a single pubsub message or 'lines' which will deliver a separate pubsub message for each line in the (dispatch) message. Default is 'lines'.
Types ¶
type BlobDispatcher ¶
type BlobDispatcher struct {
webhookd.WebhookDispatcher
// contains filtered or unexported fields
}
BlobDispatcher implements the `webhookd.WebhookDispatcher` interface for dispatching messages to a gocloud.dev/blob.Bucket instance. Messages are written to the underlying bucket instance with a filename derived from the SHA-256 hash of the message body.
func (*BlobDispatcher) Dispatch ¶
func (d *BlobDispatcher) Dispatch(ctx context.Context, body []byte) *webhookd.WebhookError
Dispatch will write 'body' to the underlying `gocloud.dev/blob.Bucket` instance contained by 'd'. Filenames are derived from the SHA-256 hash for 'body'.
type PubSubDispatcher ¶ added in v1.1.0
type PubSubDispatcher struct {
webhookd.WebhookDispatcher
// contains filtered or unexported fields
}
PubSubDispatcher implements the `webhookd.WebhookDispatcher` interface for dispatching messages to a `gocloud.dev/pubsub.Topic` instance.
func (*PubSubDispatcher) Dispatch ¶ added in v1.1.0
func (d *PubSubDispatcher) Dispatch(ctx context.Context, body []byte) *webhookd.WebhookError
Dispatch will write 'body' to the underlying `gocloud.dev/pubsub.Topic` instance contained by 'd'.