protocol

package
v0.0.0-...-446cd28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pipeline

type Pipeline struct {
	// The name of the pipeline.
	Name string
}

func (*Pipeline) Bytes

func (q *Pipeline) Bytes() []byte

func (*Pipeline) MarshalBinary

func (q *Pipeline) MarshalBinary() ([]byte, error)

func (*Pipeline) UnmarshalBinary

func (q *Pipeline) UnmarshalBinary(data []byte) error

type QueueMessage

type QueueMessage struct {
	// UniqueId is a unique id to identify this message. It may be used for
	// de-duplication by the stream processing.
	UniqueId ksuid.KSUID

	// Pipelines are the named pipelines to place the message on. You can think
	// of a pipeline as a series of unordered named queues.
	//
	// If there are multiple Pipelines set, then the message will be pushed
	// to each one. Pushing to Pipelines is atomic from the client, but not
	// guaranteed by the hyperscalr ingress plane. Hyperscalr ingress place will
	// attempt to push to the configured Pipelines optimistically on it's
	// end. This is the same as if multiple calls by the client were made to
	// single Pipelines.
	Pipelines []Pipeline

	// Payload message body of what you want pushed into the queue.
	//
	// It does have restrictions on size. The server is likely to reject
	// QueueMessage with total size greater than 32 KB.
	Payload []byte

	// The destination where the payload will be sent.
	WebhookDestination *Webhook
}

func QueueMessageFromNATS

func QueueMessageFromNATS(msg *nats.Msg) QueueMessage

func (*QueueMessage) Bytes

func (i *QueueMessage) Bytes() []byte

func (*QueueMessage) MarshalBinary

func (i *QueueMessage) MarshalBinary() ([]byte, error)

func (*QueueMessage) NewReader

func (i *QueueMessage) NewReader() io.Reader

func (*QueueMessage) UnmarshalBinary

func (i *QueueMessage) UnmarshalBinary(data []byte) error

type Webhook

type Webhook struct {
	// The http request Method, i.e. GET, POST.
	Method string

	// Headers to be set in the http request.
	// To understand how this is serialized, see:
	//   - https://golang.org/pkg/net/http/#Header.Write
	//   - https://golang.org/pkg/net/textproto/#Reader.ReadMIMEHeader
	Headers []byte

	// URL encoded query paramaters to be set in the http request.
	// This is marshaled and unmarshaled using Encode and ParseQuery.
	//   - https://golang.org/pkg/net/url/#Values.Encode
	//   - https://golang.org/pkg/net/url/#ParseQuery
	QueryParams string

	// URL to send the request to. You may include query parameters in the Url.
	// The QueryParams specified seperately will be appended to this Url before
	// making the request.
	//
	// This is marshaled and unmarshaled using MarshalBinary and UnmarshalBinary.
	//   - https://golang.org/pkg/net/url/#Values
	//   - https://golang.org/pkg/net/url/#ParseRequestURI
	//   - https://golang.org/pkg/net/url/#URL.MarshalBinary
	//   - https://golang.org/pkg/net/url/#URL.UnmarshalBinary
	Url []byte
}

func NewWebhook

func NewWebhook(
	method string,
	headers map[string][]string,
	queryParams urlpkg.Values,
	url string,
) (*Webhook, error)

NewWebhook is a conviencee factory for creating a Webhook. It performs validation, so if possible it's better to call this function once and re-use the resulting object.

func (*Webhook) Bytes

func (r *Webhook) Bytes() []byte

func (*Webhook) MarshalBinary

func (r *Webhook) MarshalBinary() ([]byte, error)

func (*Webhook) MarshalHeaders

func (r *Webhook) MarshalHeaders(headers http.Header) ([]byte, error)

func (*Webhook) MarshalQueryParams

func (r *Webhook) MarshalQueryParams(v urlpkg.Values) ([]byte, error)

func (*Webhook) MarshalUrl

func (r *Webhook) MarshalUrl(u urlpkg.URL) ([]byte, error)

func (*Webhook) SetHeaders

func (r *Webhook) SetHeaders(headers http.Header) error

func (*Webhook) SetQueryParams

func (r *Webhook) SetQueryParams(v urlpkg.Values) error

func (*Webhook) SetUrl

func (r *Webhook) SetUrl(u urlpkg.URL) error

func (*Webhook) UnmarshalBinary

func (r *Webhook) UnmarshalBinary(data []byte) error

func (*Webhook) UnmarshalHeaders

func (r *Webhook) UnmarshalHeaders() (http.Header, error)

func (*Webhook) UnmarshalQueryParams

func (r *Webhook) UnmarshalQueryParams() (urlpkg.Values, error)

func (*Webhook) UnmarshalUrl

func (r *Webhook) UnmarshalUrl() (urlpkg.URL, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL