langs

package
v0.0.0-...-706a057 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 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(string) 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 GoLangHelper

type GoLangHelper struct {
	BaseHelper
}

func (*GoLangHelper) BuildFromImage

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

func (*GoLangHelper) DefaultFormat

func (h *GoLangHelper) DefaultFormat() string

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(path string) 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(path string) 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 KotlinLangHelper

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

KotlinLangHelper provides a set of helper methods for the lifecycle of Kotlin Maven projects

func (*KotlinLangHelper) BuildFromImage

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

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

func (*KotlinLangHelper) Cmd

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

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

func (*KotlinLangHelper) DefaultFormat

func (lh *KotlinLangHelper) DefaultFormat() string

Kotlin defaults to http

func (*KotlinLangHelper) DockerfileBuildCmds

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

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

func (*KotlinLangHelper) DockerfileCopyCmds

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

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

func (*KotlinLangHelper) Extensions

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

func (*KotlinLangHelper) FixImagesOnInit

func (lh *KotlinLangHelper) FixImagesOnInit() bool

func (*KotlinLangHelper) GenerateBoilerplate

func (lh *KotlinLangHelper) GenerateBoilerplate(path string) error

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

func (*KotlinLangHelper) Handles

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

func (*KotlinLangHelper) HasBoilerplate

func (lh *KotlinLangHelper) HasBoilerplate() bool

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

func (*KotlinLangHelper) HasPreBuild

func (lh *KotlinLangHelper) HasPreBuild() bool

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

func (*KotlinLangHelper) LangStrings

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

func (*KotlinLangHelper) PreBuild

func (lh *KotlinLangHelper) PreBuild() error

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

func (*KotlinLangHelper) RunFromImage

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

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

func (*KotlinLangHelper) Runtime

func (h *KotlinLangHelper) 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(string) 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) DefaultFormat

func (lh *NodeLangHelper) DefaultFormat() string

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) GenerateBoilerplate

func (lh *NodeLangHelper) GenerateBoilerplate(path string) error

func (*NodeLangHelper) Handles

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

func (*NodeLangHelper) HasBoilerplate

func (lh *NodeLangHelper) HasBoilerplate() 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 PythonLangHelper

type PythonLangHelper struct {
	BaseHelper
	Version string
}

func (*PythonLangHelper) BuildFromImage

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

func (*PythonLangHelper) DefaultFormat

func (h *PythonLangHelper) DefaultFormat() string

func (*PythonLangHelper) DockerfileBuildCmds

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

func (*PythonLangHelper) DockerfileCopyCmds

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

func (*PythonLangHelper) Entrypoint

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

func (*PythonLangHelper) Extensions

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

func (*PythonLangHelper) GenerateBoilerplate

func (h *PythonLangHelper) GenerateBoilerplate(path string) error

func (*PythonLangHelper) Handles

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

func (*PythonLangHelper) HasBoilerplate

func (h *PythonLangHelper) HasBoilerplate() bool

func (*PythonLangHelper) IsMultiStage

func (h *PythonLangHelper) IsMultiStage() bool

func (*PythonLangHelper) LangStrings

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

func (*PythonLangHelper) RunFromImage

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

func (*PythonLangHelper) Runtime

func (h *PythonLangHelper) Runtime() string

type RubyLangHelper

type RubyLangHelper struct {
	BaseHelper
}

func (*RubyLangHelper) BuildFromImage

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

func (*RubyLangHelper) DefaultFormat

func (h *RubyLangHelper) DefaultFormat() string

func (*RubyLangHelper) DockerfileBuildCmds

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

func (*RubyLangHelper) DockerfileCopyCmds

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

func (*RubyLangHelper) Entrypoint

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

func (*RubyLangHelper) Extensions

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

func (*RubyLangHelper) GenerateBoilerplate

func (h *RubyLangHelper) GenerateBoilerplate(path string) error

func (*RubyLangHelper) Handles

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

func (*RubyLangHelper) HasBoilerplate

func (h *RubyLangHelper) HasBoilerplate() bool

func (*RubyLangHelper) LangStrings

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

func (*RubyLangHelper) RunFromImage

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

func (*RubyLangHelper) Runtime

func (h *RubyLangHelper) Runtime() string

Jump to

Keyboard shortcuts

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