Documentation ¶
Index ¶
- Constants
- type Builder
- type Client
- func (c *Client) Create(runtime, template, name, root string) (err error)
- func (c *Client) Describe(name, root string) (fd FunctionDescription, err error)
- func (c *Client) List() ([]string, error)
- func (c *Client) Remove(name, root string) error
- func (c *Client) Run(root string) error
- func (c *Client) Update(root string) (err error)
- type Config
- type DNSProvider
- type Deployer
- type Describer
- type Function
- type FunctionDescription
- type Initializer
- type Lister
- type Option
- func WithBuilder(d Builder) Option
- func WithDNSProvider(provider DNSProvider) Option
- func WithDeployer(d Deployer) Option
- func WithDescriber(describer Describer) Option
- func WithDomainSearchLimit(limit int) Option
- func WithInitializer(i Initializer) Option
- func WithInternal(i bool) Option
- func WithLister(l Lister) Option
- func WithLocal(l bool) Option
- func WithProgressListener(p ProgressListener) Option
- func WithPusher(d Pusher) Option
- func WithRemover(r Remover) Option
- func WithRunner(r Runner) Option
- func WithUpdater(u Updater) Option
- func WithVerbose(v bool) Option
- type ProgressListener
- type Pusher
- type Remover
- type Runner
- type Subscription
- type Updater
Constants ¶
const ConfigFileName = ".faas.yaml"
ConfigFileName is an optional file checked for in the function root.
const DefaultNamespace = "faas"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface { // Build a service function of the given name with source located at path. // returns the image name built. Build(name, runtime, path string) (image string, err error) }
Builder of function source to runnable image.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for a given Function.
func (*Client) Create ¶
Create a service function of the given runtime. Name and Root are optional: Name is derived from root if possible. Root is defaulted to the current working directory.
func (*Client) Describe ¶
func (c *Client) Describe(name, root string) (fd FunctionDescription, err error)
Describe a function. Name takes precidence. If no name is provided, the function defined at root is used.
func (*Client) Remove ¶
Remove a function. Name takes precidence. If no name is provided, the function defined at root is used.
type Config ¶
type Config struct { // Name specifies the name to be used for this function. As a config option, // this value, if provided, takes precidence over the path-derived name but // not over the Option WithName, if provided. Name string `yaml:"name"` // Runtime of the implementation. Runtime string `yaml:"runtime"` }
Config object which provides another mechanism for overriding client static defaults. Applied prior to the WithX options, such that the options take precedence if they are provided.
type DNSProvider ¶
type DNSProvider interface { // Provide the given name by routing requests to address. Provide(name, address string) }
DNSProvider exposes DNS services necessary for serving the Function.
type Deployer ¶
type Deployer interface { // Deploy a service function of given name, using given backing image. Deploy(name, image string) (address string, err error) }
Deployer of function source to running status.
type Describer ¶
type Describer interface {
Describe(name string) (description FunctionDescription, err error)
}
type Function ¶
type Function struct {
// contains filtered or unexported fields
}
func NewFunction ¶
func (*Function) DerivedName ¶
DerivedName returns the name that will be used if path derivation is choosen, limited in its upward recursion. This is exposed for preemptive calculation for interactive confirmation, such as via a CLI.
func (*Function) Initialize ¶
func (f *Function) Initialize(runtime, context, name string, domainSearchLimit int, initializer Initializer) (err error)
func (*Function) Initialized ¶
type FunctionDescription ¶
type FunctionDescription struct { Name string `json:"name" yaml:"name"` Routes []string `json:"routes" yaml:"routes"` Subscriptions []Subscription `json:"subscriptions" yaml:"subscriptions"` }
type Initializer ¶
type Initializer interface { // Initialize a Function of the given name, template configuration ` // (expected signature) using a context template. Initialize(runtime, template, path string) error }
Initializer creates the initial/stub Function code on first create.
type Lister ¶
type Lister interface { // List the service functions currently deployed. List() ([]string, error) }
Lister of deployed services.
type Option ¶
type Option func(*Client)
Option defines a function which when passed to the Client constructor optionally mutates private members at time of instantiation.
func WithBuilder ¶
WithBuilder provides the concrete implementation of a builder.
func WithDNSProvider ¶
func WithDNSProvider(provider DNSProvider) Option
WithDNSProvider proivdes a DNS provider implementation for registering the effective DNS name which is either explicitly set via WithName or is derived from the root path.
func WithDeployer ¶
WithDeployer provides the concrete implementation of a deployer.
func WithDescriber ¶
WithDescriber provides a concrete implementation of a function describer.
func WithDomainSearchLimit ¶
WithDomainSearchLimit sets the maximum levels of upward recursion used when attempting to derive effective DNS name from root path. Ignored if DNS was explicitly set via WithName.
func WithInitializer ¶
func WithInitializer(i Initializer) Option
WithInitializer provides the concrete implementation of the Function initializer (generates stub code on initial create).
func WithInternal ¶
WithInternal sets the internal (no public route) mode for deployed function.
func WithLister ¶
WithLister provides the concrete implementation of a lister.
func WithProgressListener ¶
func WithProgressListener(p ProgressListener) Option
WithProgressListener provides a concrete implementation of a listener to be notified of progress updates.
func WithPusher ¶
WithPusher provides the concrete implementation of a pusher.
func WithRemover ¶
WithRemover provides the concrete implementation of a remover.
func WithRunner ¶
WithRunner provides the concrete implementation of a deployer.
func WithUpdater ¶
WithUpdater provides the concrete implementation of an updater.
type ProgressListener ¶
type ProgressListener interface { // SetTotal steps of the given task. SetTotal(int) // Increment to the next step with the given message. Increment(message string) // Complete signals completion, which is expected to be somewhat different than a step increment. Complete(message string) // Done signals a cessation of progress updates. Should be called in a defer statement to ensure // the progress listener can stop any outstanding tasks such as synchronous user updates. Done() }
ProgressListener is notified of task progress.