file

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: Apache-2.0 Imports: 18 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Aos = afero.NewOsFs()

Aos returns filesystem object with standard set of os methods implemented by afero package

Functions

func Clone

func Clone(url string) (string, error)

Clone runs `git clone` operation for specified URL and returns local path to repository root directory

func Download

func Download(url string) (string, error)

Download receives URL and return path to saved file

func IsDir added in v0.0.10

func IsDir(path string) bool

IsDir return true if path is directory

func IsGit

func IsGit(path string) bool

IsGit most likely return true if path is URL to git repository

func IsGitFile added in v0.0.10

func IsGitFile(path string) (string, string)

IsGitFile accepts string and, if this string is git repsotiry, returns URL to clone and relative file path inside cloned repository directory Otherwise it returns empty strings

func IsLocal

func IsLocal(path string) bool

IsLocal return true if path is local filesystem

func IsRegistry

func IsRegistry(path string) bool

IsRegistry return true if path "behaves" like URL to docker registry

func IsRemote

func IsRemote(path string) bool

IsRemote return true if path is URL

func MakeDir added in v0.0.12

func MakeDir(path string) error

MakeDir created directory and all missing parents

func RandString added in v0.0.12

func RandString(n int) string

RandString accepts integer value N and returns random string with length of N

func RandStringDNS added in v0.0.12

func RandStringDNS(n int) string

RandStringDNS accepts integer value N and returns "DNS-friendly" random string with length of N

func Write added in v0.0.12

func Write(filename, data string) error

Write creates file named as passed filename and writes data into this file

Types

type Copy

type Copy struct {
	Pod         string
	Container   string
	Namespace   string
	Source      string
	Destination string
}

Copy contains information to copy local path to remote destination

func (*Copy) RemoteExec

func (c *Copy) RemoteExec(clientset *client.ConfigSet, command string, file io.Reader) (string, string, error)

RemoteExec executes command on remote pod and returns stdout and stderr output

func (*Copy) Upload

func (c *Copy) Upload(clientset *client.ConfigSet) error

Upload receives Copy structure, creates tarball of local source path and uploads it to active (un)tar process on remote pod

type Definition added in v0.0.8

type Definition struct {
	Service     string              `yaml:"service,omitempty"`
	Description string              `yaml:"description,omitempty"`
	Provider    TriggermeshProvider `yaml:"provider,omitempty"`
	Repository  string              `yaml:"repository,omitempty"`
	Functions   map[string]Function `yaml:"functions,omitempty"`
	Include     []string            `yaml:"include,omitempty"`
}

Definition represents serverless.yaml file structure

func ParseManifest added in v0.0.11

func ParseManifest(path string) (Definition, error)

ParseManifest accepts serverless yaml file path and returns decoded structure

func (Definition) Validate added in v0.0.11

func (definition Definition) Validate() error

Validate function verifies that provided service Definition object contains required set of keys and values

type Function

type Function struct {
	Handler     string            `yaml:"handler,omitempty"`
	Source      string            `yaml:"source,omitempty"`
	Revision    string            `yaml:"revision,omitempty"`
	Runtime     string            `yaml:"runtime,omitempty"`
	Concurrency int               `yaml:"concurrency,omitempty"`
	Buildargs   []string          `yaml:"buildargs,omitempty"`
	Description string            `yaml:"description,omitempty"`
	Labels      []string          `yaml:"labels,omitempty"`
	Environment map[string]string `yaml:"environment,omitempty"`
	EnvSecrets  []string          `yaml:"env-secrets,omitempty"`
	Annotations map[string]string `yaml:"annotations,omitempty"`
	Schedule    []Schedule        `yaml:"schedule,omitempty"`
}

Function describes function definition in serverless format

type Schedule added in v0.0.10

type Schedule struct {
	Cron        string
	JSONData    string
	Description string
}

Schedule struct contains a data in JSON format and a cron that defines how often events should be sent to a function. Description string may be used to explain events purpose.

type TriggermeshProvider added in v0.0.12

type TriggermeshProvider struct {
	Name         string            `yaml:"name,omitempty"`
	PullPolicy   string            `yaml:"pull-policy,omitempty"`
	Namespace    string            `yaml:"namespace,omitempty"`
	Runtime      string            `yaml:"runtime,omitempty"`
	Buildtimeout string            `yaml:"buildtimeout,omitempty"`
	Environment  map[string]string `yaml:"environment,omitempty"`
	EnvSecrets   []string          `yaml:"env-secrets,omitempty"`
	Annotations  map[string]string `yaml:"annotations,omitempty"`

	// registry configs moved to client Configset
	// these variables kept for backward compatibility
	Registry       string `yaml:"registry,omitempty"`
	RegistrySecret string `yaml:"registry-secret,omitempty"`
}

TriggermeshProvider structure contains serverless provider parameters specific to triggermesh

Jump to

Keyboard shortcuts

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