appsource

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: Apache-2.0 Imports: 18 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(options.Options) error
	// Runnables returns all of the available Runnables
	Runnables() []directive.Runnable
	// FindRunnable directs the AppSource to attempt to find
	// a particular Runnable and make it available at next
	// AppSource state sync via a call to Runnables().
	// ErrRunnableNotFound should be returned if the Runnable cannot be found.
	FindRunnable(fqfn, authHeader string) (*directive.Runnable, error)
	// Handlers returns the handlers for the app
	Handlers() []directive.Handler
	// Schedules returns the requested schedules for the app
	Schedules() []directive.Schedule
	// Connections returns the connections needed for the app
	Connections() directive.Connections
	// Authentication provides any auth headers or metadata for the app
	Authentication() directive.Authentication
	// Capabilities provides the application's configured capabilities
	Capabilities() *rcap.CapabilityConfig
	// File is a source of files for the Runnables
	// TODO: refactor this into a set of capabilities / profiles
	File(string) ([]byte, error)
	// Queries returns the database queries that should be made available
	Queries() []directive.DBQuery
	// Meta returns metadata about the app
	Meta() 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) Authentication added in v0.3.1

func (b *BundleSource) Authentication() directive.Authentication

Authentication returns the Authentication for the app

func (*BundleSource) Capabilities added in v0.3.1

func (b *BundleSource) Capabilities() *rcap.CapabilityConfig

Capabilities returns the configuration for the app's capabilities

func (*BundleSource) Connections added in v0.3.1

func (b *BundleSource) Connections() directive.Connections

Connections returns the Connections for the app

func (*BundleSource) File

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

File returns a requested file

func (*BundleSource) FindRunnable

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

FindRunnable searches for and returns the requested runnable otherwise ErrRunnableNotFound

func (*BundleSource) Handlers

func (b *BundleSource) Handlers() []directive.Handler

Handlers returns the handlers for the app

func (*BundleSource) Meta

func (b *BundleSource) Meta() Meta

func (*BundleSource) Queries added in v0.4.0

func (b *BundleSource) Queries() []directive.DBQuery

Queries returns the Queries available to the app

func (*BundleSource) Runnables

func (b *BundleSource) Runnables() []directive.Runnable

Runnables returns the Runnables for the app

func (*BundleSource) Schedules

func (b *BundleSource) Schedules() []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) Authentication added in v0.3.1

func (h *HTTPSource) Authentication() directive.Authentication

Authentication returns the Authentication for the app

func (*HTTPSource) Capabilities added in v0.3.1

func (h *HTTPSource) Capabilities() *rcap.CapabilityConfig

Capabilities returns the Capabilities for the app

func (*HTTPSource) Connections added in v0.3.1

func (h *HTTPSource) Connections() directive.Connections

Connections returns the Connections for the app

func (*HTTPSource) File

func (h *HTTPSource) File(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() []directive.Handler

Handlers returns the handlers for the app

func (*HTTPSource) Meta

func (h *HTTPSource) Meta() Meta

func (*HTTPSource) Queries added in v0.4.0

func (h *HTTPSource) Queries() []directive.DBQuery

Queries returns the Queries for the app

func (*HTTPSource) Runnables

func (h *HTTPSource) Runnables() []directive.Runnable

Runnables returns the Runnables for the app

func (*HTTPSource) Schedules

func (h *HTTPSource) Schedules() []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) Authentication added in v0.3.1

func (b *HeadlessBundleSource) Authentication() directive.Authentication

Authentication returns the Authentication for the app

func (*HeadlessBundleSource) Capabilities added in v0.3.1

func (b *HeadlessBundleSource) Capabilities() *rcap.CapabilityConfig

Capabilities returns the Capabilities for the app

func (*HeadlessBundleSource) Connections added in v0.3.1

func (h *HeadlessBundleSource) Connections() directive.Connections

Connections returns the Connections for the app

func (*HeadlessBundleSource) File

func (h *HeadlessBundleSource) File(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() []directive.Handler

Handlers returns the handlers for the app

func (*HeadlessBundleSource) Meta

func (h *HeadlessBundleSource) Meta() Meta

func (*HeadlessBundleSource) Queries added in v0.4.0

func (b *HeadlessBundleSource) Queries() []directive.DBQuery

Queries returns the Queries for the app

func (*HeadlessBundleSource) Runnables

func (h *HeadlessBundleSource) Runnables() []directive.Runnable

Runnables returns the Runnables for the app

func (*HeadlessBundleSource) Schedules

func (h *HeadlessBundleSource) Schedules() []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"`
}

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