stack

package
Version: v0.0.0-...-a230119 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: MIT Imports: 12 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidSchemaVersions = []string{
	"1.0",
}

ValidSchemaVersions available schema versions

Functions

func IsValidSchemaVersion

func IsValidSchemaVersion(schemaVersion string) bool

IsValidSchemaVersion validates schema version

func IsValidTemplate

func IsValidTemplate(lang string) bool

Types

type BuildOption

type BuildOption struct {
	Name     string   `yaml:"name"`
	Packages []string `yaml:"packages"`
}

BuildOption a named build option for one or more packages

type Configuration

type Configuration struct {
	StackConfig StackConfiguration `yaml:"configuration"`
}

Configuration for the stack.yml file

type EnvironmentFile

type EnvironmentFile struct {
	Environment map[string]string `yaml:"environment"`
}

EnvironmentFile represents external file for environment data

type Function

type Function struct {
	// Name of deployed function
	Name string `yaml:"-"`

	Language string `yaml:"lang"`

	// Handler Local folder to use for function
	Handler string `yaml:"handler"`

	// Image Docker image name
	Image string `yaml:"image"`

	FProcess string `yaml:"fprocess"`

	Environment map[string]string `yaml:"environment"`

	// Secrets list of secrets to be made available to function
	Secrets []string `yaml:"secrets,omitempty"`

	SkipBuild bool `yaml:"skip_build,omitempty"`

	Constraints *[]string `yaml:"constraints,omitempty"`

	// EnvironmentFile is a list of files to import and override environmental variables.
	// These are overriden in order.
	EnvironmentFile []string `yaml:"environment_file,omitempty"`

	Labels *map[string]string `yaml:"labels,omitempty"`

	// Limits for function
	Limits *FunctionResources `yaml:"limits,omitempty"`

	// Requests of resources requested by function
	Requests *FunctionResources `yaml:"requests,omitempty"`

	// ReadOnlyRootFilesystem is used to set the container filesystem to read-only
	ReadOnlyRootFilesystem bool `yaml:"readonly_root_filesystem,omitempty"`

	// BuildOptions to determine native packages
	BuildOptions []string `yaml:"build_options,omitempty"`

	// Annotations
	Annotations *map[string]string `yaml:"annotations,omitempty"`

	// Namespace of the function
	Namespace string `yaml:"namespace,omitempty"`

	// BuildArgs for providing build-args
	BuildArgs map[string]string `yaml:"build_args,omitempty"`

	// Platforms for use with buildx and faas-cli publish
	Platforms string `yaml:"platforms,omitempty"`
}

Function as deployed or built on FaaS

type FunctionResources

type FunctionResources struct {
	Memory string `yaml:"memory"`
	CPU    string `yaml:"cpu"`
}

FunctionResources Memory and CPU

type LanguageTemplate

type LanguageTemplate struct {
	Language string `yaml:"language,omitempty"`
	FProcess string `yaml:"fprocess,omitempty"`

	BuildOptions []BuildOption `yaml:"build_options,omitempty"`
	// WelcomeMessage is printed to the user after generating a function
	WelcomeMessage string `yaml:"welcome_message,omitempty"`
	// HandlerFolder to copy the function code into
	HandlerFolder string `yaml:"handler_folder,omitempty"`
}

LanguageTemplate read from template.yml within root of a language template folder

func LoadLanguageTemplate

func LoadLanguageTemplate(lang string) (*LanguageTemplate, error)

LoadLanguageTemplate loads language template details from template.yml file.

func ParseYAMLDataForLanguageTemplate

func ParseYAMLDataForLanguageTemplate(fileData []byte) (*LanguageTemplate, error)

ParseYAMLDataForLanguageTemplate parses YAML data into language template

func ParseYAMLForLanguageTemplate

func ParseYAMLForLanguageTemplate(file string) (*LanguageTemplate, error)

type Provider

type Provider struct {
	Name       string `yaml:"name"`
	GatewayURL string `yaml:"gateway"`
}

Provider for the FaaS set of functions.

type Services

type Services struct {
	Version            string              `yaml:"version,omitempty"`
	Functions          map[string]Function `yaml:"functions,omitempty"`
	Provider           Provider            `yaml:"provider,omitempty"`
	StackConfiguration StackConfiguration  `yaml:"configuration,omitempty"`
}

Services root level YAML file to define FaaS function-set

func ParseYAMLData

func ParseYAMLData(fileData []byte, regex string, filter string, envsubst bool) (*Services, error)

ParseYAMLData parse YAML data into a stack of "services".

func ParseYAMLFile

func ParseYAMLFile(yamlFile, regex, filter string, envsubst bool) (*Services, error)

ParseYAMLFile parse YAML file into a stack of "services".

type StackConfiguration

type StackConfiguration struct {
	TemplateConfigs []TemplateSource `yaml:"templates"`

	// CopyExtraPaths specifies additional paths (relative to the stack file) that will be copied
	// into the functions build context, e.g. specifying `"common"` will look for and copy the
	// "common/" folder of file in the same root as the stack file.  All paths must be contained
	// within the project root defined by the location of the stack file.
	//
	// The yaml uses the shorter name `copy` to make it easier for developers to read and use
	CopyExtraPaths []string `yaml:"copy"`
}

StackConfiguration for the overall stack.yml

type TemplateSource

type TemplateSource struct {
	Name   string `yaml:"name"`
	Source string `yaml:"source,omitempty"`
}

TemplateSource for build templates

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL