subscription

package
v0.0.0-...-089673d Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2019 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// TypeSync causes that function invocation result will be returned to the caller.
	TypeSync = Type("sync")
	// TypeAsync causes asynchronous event processing.
	TypeAsync = Type("async")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrInvalidSubscriptionUpdate

type ErrInvalidSubscriptionUpdate struct {
	Field string
}

ErrInvalidSubscriptionUpdate occurs when a client tries to update a subscription in a way that changes the subscription ID.

func (ErrInvalidSubscriptionUpdate) Error

type ErrPathConfict

type ErrPathConfict struct {
	Message string
}

ErrPathConfict occurs when HTTP subscription path conflicts with existing path.

func (ErrPathConfict) Error

func (e ErrPathConfict) Error() string

type ErrSubscriptionAlreadyExists

type ErrSubscriptionAlreadyExists struct {
	ID ID
}

ErrSubscriptionAlreadyExists occurs when subscription with the same ID already exists.

func (ErrSubscriptionAlreadyExists) Error

type ErrSubscriptionNotFound

type ErrSubscriptionNotFound struct {
	ID ID
}

ErrSubscriptionNotFound occurs when subscription cannot be found.

func (ErrSubscriptionNotFound) Error

func (e ErrSubscriptionNotFound) Error() string

type ErrSubscriptionValidation

type ErrSubscriptionValidation struct {
	Message string
}

ErrSubscriptionValidation occurs when subscription payload doesn't validate.

func (ErrSubscriptionValidation) Error

type ID

type ID string

ID uniquely identifies a subscription.

type Service

type Service interface {
	GetSubscription(space string, id ID) (*Subscription, error)
	ListSubscriptions(space string, filters ...metadata.Filter) (Subscriptions, error)
	CreateSubscription(s *Subscription) (*Subscription, error)
	UpdateSubscription(id ID, s *Subscription) (*Subscription, error)
	DeleteSubscription(space string, id ID) error
}

Service represents service for managing subscriptions.

type Subscription

type Subscription struct {
	Space      string         `json:"space" validate:"required,min=3,space"`
	ID         ID             `json:"subscriptionId"`
	Type       Type           `json:"type" validate:"required,eq=async|eq=sync"`
	EventType  event.TypeName `json:"eventType" validate:"required,eventType"`
	FunctionID function.ID    `json:"functionId" validate:"required"`
	Path       string         `json:"path" validate:"required,urlPath"`
	Method     string         `json:"method" validate:"required,eq=GET|eq=POST|eq=DELETE|eq=PUT|eq=PATCH|eq=HEAD|eq=OPTIONS"`

	Metadata metadata.Metadata `json:"metadata,omitempty"`
}

Subscription maps event type to a function.

func (Subscription) MarshalLogObject

func (s Subscription) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject is a part of zapcore.ObjectMarshaler interface

type Subscriptions

type Subscriptions []*Subscription

Subscriptions is an array of subscriptions.

type Type

type Type string

Type of subscription.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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