client

package
v0.0.0-...-04bf11e Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDuplicates

func CheckDuplicates(models []Model) error

CheckDuplicates checks that the list of models doesn't have one or more models with the same type and name

func Checksum

func Checksum(files, ignore []string) ([]byte, error)

Checksum calculates the sha1 checksum of a the contents of a list of files. The files are processed in the order of the input so sort the files to ensure consistent hashing. Returns an error in case no files were provided or all files were filtered by the ignore.

func CollectSource

func CollectSource(dir string, ignore []string) ([]string, error)

CollectSource collects source files belonging to a function. Directories and files that match the ignore patterns are excluded.

func Compress

func Compress(files []string) (io.Reader, error)

Compress compresses a list of files to a tar.gz archive

func Upload

func Upload(data io.Reader, url string) error

Upload uploads data to a url. The upload is done through a http put. Has a timeout of 1 minute

func Walk

func Walk(dir string, ignoreDirs []string) ([]string, error)

Walk walks a target directory looking for models. Returns a list of potential model definitions. Directories can be ignored by supplying patterns to ignoreDirs. See https://golang.org/pkg/path/filepath/#Match for details.

Types

type Deployment

type Deployment interface {
	Deployment() *DeploymentSpec
}

Deployment is the configuration for a deployment on disk.

type DeploymentSpec

type DeploymentSpec struct {
	// EnvironmentLabels is the label seletor for which environment(s) should be
	// the destination of the deployment. The environment must have every label
	// assigned to be included.
	EnvironmentLabels map[string]string `json:"environment"`
	// FunctionLabels is the label selector for which function(s) should be part
	// of the deployment. Every label must match for the function to be included.
	FunctionLabels map[string]string `json:"function"`
}

DeploymentSpec represents a deployment.

type Function

type Function interface {
	Function() *FunctionSpec
}

Function is the configuration for a function on disk.

type FunctionAWSSpec

type FunctionAWSSpec struct {
	// Timeout is the timeout in seconds for the function
	Timeout int64 `json:"timeout,omitempty"`
	// Memory is the memory in mb for the function
	Memory int64 `json:"memory,omitempty"`
}

FunctionAWSSpec contains AWS function (Lambda) specific configuration info.

type FunctionSpec

type FunctionSpec struct {
	// Runtime is the function runtime.
	Runtime string `json:"runtime"`
	// AWS is the Amazon Web Services specific configuration for the function.
	AWS *FunctionAWSSpec `json:"aws,omitempty"`
}

FunctionSpec represents a function specification.

type Meta

type Meta struct {
	// Name is the name for a model. It must be unique among other model of the same type.
	Name string `json:"name"`
	// Labels are used to identify a model.
	Labels map[string]string `json:"labels"`
}

Meta contains metadata for a model.

type Model

type Model interface {
	// File is the configuration file the model definition was parsed from.
	File() string
	// Meta contains metadata for a model.
	Meta() *Meta
	// Type defines what type of model this is.
	Type() ModelType
	// contains filtered or unexported methods
}

Model is a generic model on disk. It can represent any model type.

func Load

func Load(file string) ([]Model, error)

Load loads a model from a file. The file can be a yaml or json and can contain one or more models.

type ModelType

type ModelType string

ModelType defines the model type. The type is read from the spec file and determines how the model is interpreted.

const (
	// ModelTypeFunction is the type for a function.
	ModelTypeFunction ModelType = "function"
	// ModelTypeDeployment is the type for a deployment.
	ModelTypeDeployment ModelType = "deployment"
)

Jump to

Keyboard shortcuts

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