appsource

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRunnableNotFound     = errors.New("failed to find requested Runnable")
	ErrAuthenticationFailed = errors.New("failed to authenticate")
)

Functions

func TokenHash added in v0.4.0

func TokenHash(token string) []byte

TokenHash creates a SHA-256 hash of the given string.

Types

type AppSource

type AppSource interface {
	// Start indicates to the AppSource that it should prepare for app startup.
	Start(opts options.Options) error

	// Runnables returns all of the available Runnables.
	Runnables(ident, version string) []directive.Runnable

	// FindRunnable attempts to find the given Runnable by its fqfn, and returns ErrRunnableNotFound if it cannot.
	FindRunnable(fqfn, authHeader string) (*directive.Runnable, error)

	// Handlers returns the handlers for the app.
	Handlers(ident, version string) []directive.Handler

	// Schedules returns the requested schedules for the app.
	Schedules(ident, version string) []directive.Schedule

	// Connections returns the connections needed for the app.
	Connections(ident, version string) directive.Connections

	// Authentication provides any auth headers or metadata for the app.
	Authentication(ident, version string) directive.Authentication

	// Capabilities provides the application's configured capabilities.
	Capabilities(ident, namespace, version string) *rcap.CapabilityConfig

	// File is a source of files for the Runnables
	// TODO: refactor this into a set of capabilities / profiles.
	File(identifier, version, path string) ([]byte, error)

	// Queries returns the database queries that should be made available.
	Queries(ident, version string) []directive.DBQuery

	// Applications returns a slice of Meta, metadata about the apps in that app source.
	Applications() []Meta
}

func NewBundleSource

func NewBundleSource(path string) AppSource

NewBundleSource creates a new BundleSource that looks for a bundle at path.

func NewHTTPSource

func NewHTTPSource(host string) AppSource

NewHTTPSource creates a new HTTPSource that looks for a bundle at [host].

func NewHeadlessBundleSource

func NewHeadlessBundleSource(path string) AppSource

NewHeadlessBundleSource creates a new HeadlessBundleSource that looks for a bundle at path.

type AppSourceVKRouter

type AppSourceVKRouter struct {
	// contains filtered or unexported fields
}

AppSourceVKRouter is a helper struct to generate a VK router that can serve an HTTP AppSource based on an actual AppSource object.

func NewAppSourceVKRouter

func NewAppSourceVKRouter(appSource AppSource, opts options.Options) *AppSourceVKRouter

NewAppSourceVKRouter creates a new AppSourceVKRouter.

func (*AppSourceVKRouter) AuthenticationHandler added in v0.3.1

func (a *AppSourceVKRouter) AuthenticationHandler() vk.HandlerFunc

AuthenticationHandler is a handler to fetch Authentication data.

func (*AppSourceVKRouter) CapabilitiesHandler added in v0.3.1

func (a *AppSourceVKRouter) CapabilitiesHandler() vk.HandlerFunc

CapabilitiesHandler is a handler to fetch Capabilities data.

func (*AppSourceVKRouter) ConnectionsHandler added in v0.3.1

func (a *AppSourceVKRouter) ConnectionsHandler() vk.HandlerFunc

ConnectionsHandler is a handler to fetch Connection data.

func (*AppSourceVKRouter) FileHandler

func (a *AppSourceVKRouter) FileHandler() vk.HandlerFunc

FileHandler is a handler to fetch Files.

func (*AppSourceVKRouter) FindRunnableHandler

func (a *AppSourceVKRouter) FindRunnableHandler() vk.HandlerFunc

FindRunnableHandler is a handler to find a single Runnable.

func (*AppSourceVKRouter) GenerateRouter

func (a *AppSourceVKRouter) GenerateRouter() (*vk.Router, error)

GenerateRouter generates a VK router that uses an AppSource to serve data.

func (*AppSourceVKRouter) HandlersHandler

func (a *AppSourceVKRouter) HandlersHandler() vk.HandlerFunc

HandlersHandler is a handler to fetch Handlers.

func (*AppSourceVKRouter) MetaHandler

func (a *AppSourceVKRouter) MetaHandler() vk.HandlerFunc

MetaHandler is a handler to fetch Metadata.

func (*AppSourceVKRouter) RunnablesHandler

func (a *AppSourceVKRouter) RunnablesHandler() vk.HandlerFunc

RunnablesHandler is a handler to fetch Runnables.

func (*AppSourceVKRouter) SchedulesHandler

func (a *AppSourceVKRouter) SchedulesHandler() vk.HandlerFunc

SchedulesHandler is a handler to fetch Schedules.

type BundleSource

type BundleSource struct {
	// contains filtered or unexported fields
}

BundleSource is an AppSource backed by a bundle file.

func (*BundleSource) Applications added in v0.4.3

func (b *BundleSource) Applications() []Meta

func (*BundleSource) Authentication added in v0.3.1

func (b *BundleSource) Authentication(identifier, version string) directive.Authentication

Authentication returns the Authentication for the app.

func (*BundleSource) Capabilities added in v0.3.1

func (b *BundleSource) Capabilities(identifier, namespace, version string) *rcap.CapabilityConfig

func (*BundleSource) Connections added in v0.3.1

func (b *BundleSource) Connections(identifier, version string) directive.Connections

Connections returns the Connections for the app.

func (*BundleSource) File

func (b *BundleSource) File(identifier, version, filename string) ([]byte, error)

File returns a requested file.

func (*BundleSource) FindRunnable

func (b *BundleSource) FindRunnable(fqfn, _ string) (*directive.Runnable, error)

FindRunnable searches for and returns the requested runnable otherwise ErrRunnableNotFound.

func (*BundleSource) Handlers

func (b *BundleSource) Handlers(identifier, version string) []directive.Handler

Handlers returns the handlers for the app.

func (*BundleSource) Queries added in v0.4.0

func (b *BundleSource) Queries(identifier, version string) []directive.DBQuery

Queries returns the Queries available to the app.

func (*BundleSource) Runnables

func (b *BundleSource) Runnables(identifier, version string) []directive.Runnable

Runnables returns the Runnables for the app.

func (*BundleSource) Schedules

func (b *BundleSource) Schedules(identifier, version string) []directive.Schedule

Schedules returns the schedules for the app.

func (*BundleSource) Start

func (b *BundleSource) Start(opts options.Options) error

Start initializes the app source.

type HTTPSource

type HTTPSource struct {
	// contains filtered or unexported fields
}

HTTPSource is an AppSource backed by an HTTP client connected to a remote source.

func (*HTTPSource) Applications added in v0.4.3

func (h *HTTPSource) Applications() []Meta

func (*HTTPSource) Authentication added in v0.3.1

func (h *HTTPSource) Authentication(ident, version string) directive.Authentication

Authentication returns the Authentication for the app.

func (*HTTPSource) Capabilities added in v0.3.1

func (h *HTTPSource) Capabilities(ident, namespace, version string) *rcap.CapabilityConfig

Capabilities returns the Capabilities for the app.

func (*HTTPSource) Connections added in v0.3.1

func (h *HTTPSource) Connections(ident, version string) directive.Connections

Connections returns the Connections for the app.

func (*HTTPSource) File

func (h *HTTPSource) File(ident, version, filename string) ([]byte, error)

File returns a requested file.

func (*HTTPSource) FindRunnable

func (h *HTTPSource) FindRunnable(FQFN, auth string) (*directive.Runnable, error)

FindRunnable returns a nil error if a Runnable with the provided FQFN can be made available at the next sync, otherwise ErrRunnableNotFound is returned.

func (*HTTPSource) Handlers

func (h *HTTPSource) Handlers(ident, version string) []directive.Handler

Handlers returns the handlers for the app.

func (*HTTPSource) Queries added in v0.4.0

func (h *HTTPSource) Queries(ident, version string) []directive.DBQuery

Queries returns the Queries for the app.

func (*HTTPSource) Runnables

func (h *HTTPSource) Runnables(ident, version string) []directive.Runnable

Runnables returns the Runnables for the app.

func (*HTTPSource) Schedules

func (h *HTTPSource) Schedules(ident, version string) []directive.Schedule

Schedules returns the schedules for the app.

func (*HTTPSource) Start

func (h *HTTPSource) Start(opts options.Options) error

Start initializes the app source.

type HeadlessBundleSource

type HeadlessBundleSource struct {
	// contains filtered or unexported fields
}

HeadlessBundleSource is an AppSource backed by a bundle file (but headless).

func (*HeadlessBundleSource) Applications added in v0.4.3

func (h *HeadlessBundleSource) Applications() []Meta

Applications returns the slice of Meta for the app.

func (*HeadlessBundleSource) Authentication added in v0.3.1

func (h *HeadlessBundleSource) Authentication(identifier, version string) directive.Authentication

Authentication returns the Authentication for the app.

func (*HeadlessBundleSource) Capabilities added in v0.3.1

func (h *HeadlessBundleSource) Capabilities(identifier, namespace, version string) *rcap.CapabilityConfig

Capabilities returns the Capabilities for the app.

func (*HeadlessBundleSource) Connections added in v0.3.1

func (h *HeadlessBundleSource) Connections(_, _ string) directive.Connections

Connections returns the Connections for the app.

func (*HeadlessBundleSource) File

func (h *HeadlessBundleSource) File(identifier, version, filename string) ([]byte, error)

File returns a requested file.

func (*HeadlessBundleSource) FindRunnable

func (h *HeadlessBundleSource) FindRunnable(fqfn, auth string) (*directive.Runnable, error)

FindRunnable returns a nil error if a Runnable with the provided FQFN can be made available at the next sync, otherwise ErrRunnableNotFound is returned.

func (*HeadlessBundleSource) Handlers

func (h *HeadlessBundleSource) Handlers(identifier, version string) []directive.Handler

Handlers returns the handlers for the app.

func (*HeadlessBundleSource) Queries added in v0.4.0

func (h *HeadlessBundleSource) Queries(identifier, version string) []directive.DBQuery

Queries returns the Queries for the app.

func (*HeadlessBundleSource) Runnables

func (h *HeadlessBundleSource) Runnables(identifier, version string) []directive.Runnable

Runnables returns the Runnables for the app.

func (*HeadlessBundleSource) Schedules

func (h *HeadlessBundleSource) Schedules(_, _ string) []directive.Schedule

Schedules returns the schedules for the app.

func (*HeadlessBundleSource) Start

func (h *HeadlessBundleSource) Start(opts options.Options) error

Start initializes the app source.

type Meta

type Meta struct {
	Identifier string `json:"identifier"`
	AppVersion string `json:"appVersion"`
	Domain     string `json:"domain"`
}

Meta describes the metadata for an App.

Jump to

Keyboard shortcuts

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