langs

package
v0.0.0-...-aec958f Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBoilerplateExists = errors.New("Function boilerplate already exists")
)

Functions

This section is empty.

Types

type BaseHelper

type BaseHelper struct {
}

BaseHelper is empty implementation of LangHelper for embedding in implementations.

func (*BaseHelper) AfterBuild

func (h *BaseHelper) AfterBuild() error

func (*BaseHelper) Cmd

func (h *BaseHelper) Cmd() (string, error)

func (*BaseHelper) DefaultFormat

func (h *BaseHelper) DefaultFormat() string

func (*BaseHelper) DockerfileBuildCmds

func (h *BaseHelper) DockerfileBuildCmds() []string

func (*BaseHelper) DockerfileCopyCmds

func (h *BaseHelper) DockerfileCopyCmds() []string

func (*BaseHelper) Entrypoint

func (h *BaseHelper) Entrypoint() (string, error)

func (*BaseHelper) FixImagesOnInit

func (h *BaseHelper) FixImagesOnInit() bool

func (*BaseHelper) GenerateBoilerplate

func (h *BaseHelper) GenerateBoilerplate() error

func (*BaseHelper) HasBoilerplate

func (h *BaseHelper) HasBoilerplate() bool

func (*BaseHelper) HasPreBuild

func (h *BaseHelper) HasPreBuild() bool

func (*BaseHelper) IsMultiStage

func (h *BaseHelper) IsMultiStage() bool

func (*BaseHelper) PreBuild

func (h *BaseHelper) PreBuild() error

type DotNetLangHelper

type DotNetLangHelper struct {
	BaseHelper
}

func (*DotNetLangHelper) AfterBuild

func (lh *DotNetLangHelper) AfterBuild() error

func (*DotNetLangHelper) BuildFromImage

func (lh *DotNetLangHelper) BuildFromImage() (string, error)

func (*DotNetLangHelper) Entrypoint

func (lh *DotNetLangHelper) Entrypoint() (string, error)

func (*DotNetLangHelper) Extensions

func (lh *DotNetLangHelper) Extensions() []string

func (*DotNetLangHelper) Handles

func (h *DotNetLangHelper) Handles(lang string) bool

func (*DotNetLangHelper) HasPreBuild

func (lh *DotNetLangHelper) HasPreBuild() bool

func (*DotNetLangHelper) LangStrings

func (lh *DotNetLangHelper) LangStrings() []string

func (*DotNetLangHelper) PreBuild

func (lh *DotNetLangHelper) PreBuild() error

PreBuild for Go builds the binary so the final image can be as small as possible

func (*DotNetLangHelper) RunFromImage

func (lh *DotNetLangHelper) RunFromImage() (string, error)

func (*DotNetLangHelper) Runtime

func (h *DotNetLangHelper) Runtime() string

type GoLangHelper

type GoLangHelper struct {
	BaseHelper
}

func (*GoLangHelper) BuildFromImage

func (lh *GoLangHelper) BuildFromImage() (string, error)

func (*GoLangHelper) DockerfileBuildCmds

func (h *GoLangHelper) DockerfileBuildCmds() []string

func (*GoLangHelper) DockerfileCopyCmds

func (h *GoLangHelper) DockerfileCopyCmds() []string

func (*GoLangHelper) Entrypoint

func (lh *GoLangHelper) Entrypoint() (string, error)

func (*GoLangHelper) Extensions

func (lh *GoLangHelper) Extensions() []string

func (*GoLangHelper) GenerateBoilerplate

func (lh *GoLangHelper) GenerateBoilerplate() error

func (*GoLangHelper) Handles

func (h *GoLangHelper) Handles(lang string) bool

func (*GoLangHelper) HasBoilerplate

func (lh *GoLangHelper) HasBoilerplate() bool

func (*GoLangHelper) LangStrings

func (lh *GoLangHelper) LangStrings() []string

func (*GoLangHelper) RunFromImage

func (lh *GoLangHelper) RunFromImage() (string, error)

func (*GoLangHelper) Runtime

func (h *GoLangHelper) Runtime() string

type JavaLangHelper

type JavaLangHelper struct {
	BaseHelper
	// contains filtered or unexported fields
}

JavaLangHelper provides a set of helper methods for the lifecycle of Java Maven projects

func (*JavaLangHelper) BuildFromImage

func (lh *JavaLangHelper) BuildFromImage() (string, error)

BuildFromImage returns the Docker image used to compile the Maven function project

func (*JavaLangHelper) Cmd

func (lh *JavaLangHelper) Cmd() (string, error)

Cmd returns the Java runtime Docker entrypoint that will be executed when the function is executed.

func (*JavaLangHelper) DefaultFormat

func (lh *JavaLangHelper) DefaultFormat() string

Java defaults to http

func (*JavaLangHelper) DockerfileBuildCmds

func (lh *JavaLangHelper) DockerfileBuildCmds() []string

DockerfileBuildCmds returns the build stage steps to compile the Maven function project.

func (*JavaLangHelper) DockerfileCopyCmds

func (lh *JavaLangHelper) DockerfileCopyCmds() []string

DockerfileCopyCmds returns the Docker COPY command to copy the compiled Java function jar and dependencies.

func (*JavaLangHelper) Extensions

func (lh *JavaLangHelper) Extensions() []string

func (*JavaLangHelper) FixImagesOnInit

func (lh *JavaLangHelper) FixImagesOnInit() bool

func (*JavaLangHelper) GenerateBoilerplate

func (lh *JavaLangHelper) GenerateBoilerplate() error

GenerateBoilerplate will generate function boilerplate for a Java runtime. The default boilerplate is for a Maven project.

func (*JavaLangHelper) Handles

func (h *JavaLangHelper) Handles(lang string) bool

func (*JavaLangHelper) HasBoilerplate

func (lh *JavaLangHelper) HasBoilerplate() bool

HasBoilerplate returns whether the Java runtime has boilerplate that can be generated.

func (*JavaLangHelper) HasPreBuild

func (lh *JavaLangHelper) HasPreBuild() bool

HasPreBuild returns whether the Java Maven runtime has a pre-build step.

func (*JavaLangHelper) LangStrings

func (lh *JavaLangHelper) LangStrings() []string

TOOD: same as python, I think we should just have version tags on the single runtime, eg: `java:8` or `java:9`

func (*JavaLangHelper) PreBuild

func (lh *JavaLangHelper) PreBuild() error

PreBuild ensures that the expected the function is based is a maven project.

func (*JavaLangHelper) RunFromImage

func (lh *JavaLangHelper) RunFromImage() (string, error)

RunFromImage returns the Docker image used to run the Java function.

func (*JavaLangHelper) Runtime

func (h *JavaLangHelper) Runtime() string

type LambdaNodeHelper

type LambdaNodeHelper struct {
	BaseHelper
}

func (*LambdaNodeHelper) BuildFromImage

func (lh *LambdaNodeHelper) BuildFromImage() (string, error)

func (*LambdaNodeHelper) Cmd

func (lh *LambdaNodeHelper) Cmd() (string, error)

func (*LambdaNodeHelper) DockerfileBuildCmds

func (h *LambdaNodeHelper) DockerfileBuildCmds() []string

func (*LambdaNodeHelper) Extensions

func (lh *LambdaNodeHelper) Extensions() []string

This shouldn't match any auto-detection so returning empty slice here

func (*LambdaNodeHelper) Handles

func (h *LambdaNodeHelper) Handles(lang string) bool

func (*LambdaNodeHelper) IsMultiStage

func (lh *LambdaNodeHelper) IsMultiStage() bool

func (*LambdaNodeHelper) LangStrings

func (lh *LambdaNodeHelper) LangStrings() []string

func (*LambdaNodeHelper) RunFromImage

func (lh *LambdaNodeHelper) RunFromImage() (string, error)

func (*LambdaNodeHelper) Runtime

func (h *LambdaNodeHelper) Runtime() string

type LangHelper

type LangHelper interface {
	// Handles return whether it can handle the passed in lang string or not
	Handles(string) bool
	// LangStrings returns list of supported language strings user can use for runtime
	LangStrings() []string
	// Extension is the file extension this helper supports. Eg: .java, .go, .js
	Extensions() []string
	// Runtime that will be used for the build (includes version)
	Runtime() string
	// BuildFromImage is the base image to build off, typically fnproject/LANG:dev
	BuildFromImage() (string, error)
	// RunFromImage is the base image to use for deployment (usually smaller than the build images)
	RunFromImage() (string, error)
	// If set to false, it will use a single Docker build step, rather than multi-stage
	IsMultiStage() bool
	// Dockerfile build lines for building dependencies or anything else language specific
	DockerfileBuildCmds() []string
	// DockerfileCopyCmds will run in second/final stage of multi-stage build to copy artifacts form the build stage
	DockerfileCopyCmds() []string
	// Entrypoint sets the Docker Entrypoint. One of Entrypoint or Cmd is required.
	Entrypoint() (string, error)
	// Cmd sets the Docker command. One of Entrypoint or Cmd is required.
	Cmd() (string, error)
	// DefaultFormat provides the default fn format to set in func.yaml fn init, return "" for an empty format.
	DefaultFormat() string
	HasPreBuild() bool
	PreBuild() error
	AfterBuild() error
	// HasBoilerplate indicates whether a language has support for generating function boilerplate.
	HasBoilerplate() bool
	// GenerateBoilerplate generates basic function boilerplate. Returns ErrBoilerplateExists if the function file
	// already exists.
	GenerateBoilerplate() error
	// FixImagesOnInit determines if images should be fixed on initialization - BuildFromImage and RunFromImage will be written to func.yaml
	FixImagesOnInit() bool
}

LangHelper is the interface that language helpers must implement.

func GetLangHelper

func GetLangHelper(lang string) LangHelper

GetLangHelper returns a LangHelper for the passed in language

func Helpers

func Helpers() []LangHelper

type NodeLangHelper

type NodeLangHelper struct {
	BaseHelper
}

func (*NodeLangHelper) BuildFromImage

func (lh *NodeLangHelper) BuildFromImage() (string, error)

func (*NodeLangHelper) DockerfileBuildCmds

func (h *NodeLangHelper) DockerfileBuildCmds() []string

func (*NodeLangHelper) DockerfileCopyCmds

func (h *NodeLangHelper) DockerfileCopyCmds() []string

func (*NodeLangHelper) Entrypoint

func (lh *NodeLangHelper) Entrypoint() (string, error)

func (*NodeLangHelper) Extensions

func (lh *NodeLangHelper) Extensions() []string

func (*NodeLangHelper) Handles

func (h *NodeLangHelper) Handles(lang string) bool

func (*NodeLangHelper) LangStrings

func (lh *NodeLangHelper) LangStrings() []string

func (*NodeLangHelper) RunFromImage

func (lh *NodeLangHelper) RunFromImage() (string, error)

func (*NodeLangHelper) Runtime

func (h *NodeLangHelper) Runtime() string

type PhpLangHelper

type PhpLangHelper struct {
	BaseHelper
}

func (*PhpLangHelper) AfterBuild

func (lh *PhpLangHelper) AfterBuild() error

func (*PhpLangHelper) BuildFromImage

func (lh *PhpLangHelper) BuildFromImage() (string, error)

func (*PhpLangHelper) DockerfileBuildCmds

func (h *PhpLangHelper) DockerfileBuildCmds() []string

func (*PhpLangHelper) Entrypoint

func (lh *PhpLangHelper) Entrypoint() (string, error)

func (*PhpLangHelper) Extensions

func (lh *PhpLangHelper) Extensions() []string

func (*PhpLangHelper) Handles

func (h *PhpLangHelper) Handles(lang string) bool

func (*PhpLangHelper) HasPreBuild

func (lh *PhpLangHelper) HasPreBuild() bool

func (*PhpLangHelper) IsMultiStage

func (h *PhpLangHelper) IsMultiStage() bool

func (*PhpLangHelper) LangStrings

func (lh *PhpLangHelper) LangStrings() []string

func (*PhpLangHelper) PreBuild

func (lh *PhpLangHelper) PreBuild() error

func (*PhpLangHelper) RunFromImage

func (lh *PhpLangHelper) RunFromImage() (string, error)

func (*PhpLangHelper) Runtime

func (h *PhpLangHelper) Runtime() string

type PythonLangHelper

type PythonLangHelper struct {
	BaseHelper
	Version string
}

func (*PythonLangHelper) BuildFromImage

func (lh *PythonLangHelper) BuildFromImage() (string, error)

func (*PythonLangHelper) DockerfileBuildCmds

func (h *PythonLangHelper) DockerfileBuildCmds() []string

func (*PythonLangHelper) Entrypoint

func (lh *PythonLangHelper) Entrypoint() (string, error)

func (*PythonLangHelper) Extensions

func (lh *PythonLangHelper) Extensions() []string

func (*PythonLangHelper) Handles

func (h *PythonLangHelper) Handles(lang string) bool

func (*PythonLangHelper) IsMultiStage

func (h *PythonLangHelper) IsMultiStage() bool

func (*PythonLangHelper) LangStrings

func (lh *PythonLangHelper) LangStrings() []string

TODO: I feel like this whole versioning thing here could be done better. eg: `runtime: python:2` where we have a single lang, but support versions in tags (like docker tags).

func (*PythonLangHelper) RunFromImage

func (lh *PythonLangHelper) RunFromImage() (string, error)

func (*PythonLangHelper) Runtime

func (h *PythonLangHelper) Runtime() string

type RubyLangHelper

type RubyLangHelper struct {
	BaseHelper
}

func (*RubyLangHelper) BuildFromImage

func (lh *RubyLangHelper) BuildFromImage() (string, error)

func (*RubyLangHelper) DockerfileBuildCmds

func (h *RubyLangHelper) DockerfileBuildCmds() []string

func (*RubyLangHelper) DockerfileCopyCmds

func (h *RubyLangHelper) DockerfileCopyCmds() []string

func (*RubyLangHelper) Entrypoint

func (lh *RubyLangHelper) Entrypoint() (string, error)

func (*RubyLangHelper) Extensions

func (lh *RubyLangHelper) Extensions() []string

func (*RubyLangHelper) GenerateBoilerplate

func (lh *RubyLangHelper) GenerateBoilerplate() error

func (*RubyLangHelper) Handles

func (h *RubyLangHelper) Handles(lang string) bool

func (*RubyLangHelper) HasBoilerplate

func (lh *RubyLangHelper) HasBoilerplate() bool

func (*RubyLangHelper) LangStrings

func (lh *RubyLangHelper) LangStrings() []string

func (*RubyLangHelper) RunFromImage

func (lh *RubyLangHelper) RunFromImage() (string, error)

func (*RubyLangHelper) Runtime

func (h *RubyLangHelper) Runtime() string

type RustLangHelper

type RustLangHelper struct {
	BaseHelper
}

func (*RustLangHelper) AfterBuild

func (lh *RustLangHelper) AfterBuild() error

func (*RustLangHelper) BuildFromImage

func (lh *RustLangHelper) BuildFromImage() (string, error)

func (*RustLangHelper) DockerfileBuildCmds

func (lh *RustLangHelper) DockerfileBuildCmds() []string

func (*RustLangHelper) DockerfileCopyCmds

func (lh *RustLangHelper) DockerfileCopyCmds() []string

func (*RustLangHelper) Entrypoint

func (lh *RustLangHelper) Entrypoint() (string, error)

func (*RustLangHelper) Extensions

func (lh *RustLangHelper) Extensions() []string

func (*RustLangHelper) GenerateBoilerplate

func (lh *RustLangHelper) GenerateBoilerplate() error

func (*RustLangHelper) Handles

func (h *RustLangHelper) Handles(lang string) bool

func (*RustLangHelper) HasBoilerplate

func (lh *RustLangHelper) HasBoilerplate() bool

func (*RustLangHelper) HasPreBuild

func (lh *RustLangHelper) HasPreBuild() bool

func (*RustLangHelper) LangStrings

func (lh *RustLangHelper) LangStrings() []string

func (*RustLangHelper) PreBuild

func (lh *RustLangHelper) PreBuild() error

func (*RustLangHelper) RunFromImage

func (lh *RustLangHelper) RunFromImage() (string, error)

func (*RustLangHelper) Runtime

func (h *RustLangHelper) Runtime() string

Jump to

Keyboard shortcuts

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