Documentation ¶
Index ¶
- Constants
- func Args(context.Context, []types.Value) (types.Value, error)
- func ExpandHome(ctx context.Context, input []types.Value) (types.Value, error)
- func Family(ctx context.Context, input []types.Value) (types.Value, error)
- func IsFamilyArchLinux(ctx context.Context, input []types.Value) (types.Value, error)
- func IsFamilyDebian(ctx context.Context, input []types.Value) (types.Value, error)
- func IsFamilyRedHat(ctx context.Context, input []types.Value) (types.Value, error)
- func ParseDistroUID(ctx context.Context, input []types.Value) (types.Value, error)
- type ReadFileFunc
- func (obj *ReadFileFunc) ArgGen(index int) (string, error)
- func (obj *ReadFileFunc) Info() *interfaces.Info
- func (obj *ReadFileFunc) Init(init *interfaces.Init) error
- func (obj *ReadFileFunc) Stream(ctx context.Context) error
- func (obj *ReadFileFunc) String() string
- func (obj *ReadFileFunc) Validate() error
- type SystemFunc
Constants ¶
const (
// ModuleName is the prefix given to all the functions in this module.
ModuleName = "os"
)
const (
// ReadFileFuncName is the name this function is registered as.
ReadFileFuncName = "readfile"
)
const (
// SystemFuncName is the name this function is registered as.
SystemFuncName = "system"
)
Variables ¶
This section is empty.
Functions ¶
func Args ¶
Args returns the `argv` of the current process. Keep in mind that this will return different values depending on how this is deployed, so don't expect a result on your deploy client to behave the same as a server receiving code. FIXME: Sanitize any command-line secrets we might pass in by cli.
func ExpandHome ¶
ExpandHome expands any tilde patterns in the input path according to the currently running user. While most of the time its likely this is `root`, there is no reason the program is necessarily running as root!
func IsFamilyArchLinux ¶
IsFamilyArchLinux detects if the os family is archlinux. TODO: Detect OS changes.
func IsFamilyDebian ¶
IsFamilyDebian detects if the os family is debian. TODO: Detect OS changes.
func IsFamilyRedHat ¶
IsFamilyRedHat detects if the os family is redhat. TODO: Detect OS changes.
Types ¶
type ReadFileFunc ¶
type ReadFileFunc struct {
// contains filtered or unexported fields
}
ReadFileFunc is a function that reads the full contents from a local file. If the file contents change or the file path changes, a new string will be sent. Please note that this is different from the readfile function in the deploy package.
func (*ReadFileFunc) ArgGen ¶
func (obj *ReadFileFunc) ArgGen(index int) (string, error)
ArgGen returns the Nth arg name for this function.
func (*ReadFileFunc) Info ¶
func (obj *ReadFileFunc) Info() *interfaces.Info
Info returns some static info about itself.
func (*ReadFileFunc) Init ¶
func (obj *ReadFileFunc) Init(init *interfaces.Init) error
Init runs some startup code for this function.
func (*ReadFileFunc) Stream ¶
func (obj *ReadFileFunc) Stream(ctx context.Context) error
Stream returns the changing values that this func has over time.
func (*ReadFileFunc) String ¶
func (obj *ReadFileFunc) String() string
String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.
func (*ReadFileFunc) Validate ¶
func (obj *ReadFileFunc) Validate() error
Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.
type SystemFunc ¶
type SystemFunc struct {
// contains filtered or unexported fields
}
SystemFunc runs a string as a shell command, then produces each line from stdout. If the input string changes, then the commands are executed one after the other and the concatenation of their outputs is produced line by line.
Note that in the likely case in which the process emits several lines one after the other, the downstream resources might not run for every line unless the "Meta:realize" metaparam is set to true.
func (*SystemFunc) ArgGen ¶
func (obj *SystemFunc) ArgGen(index int) (string, error)
ArgGen returns the Nth arg name for this function.
func (*SystemFunc) Info ¶
func (obj *SystemFunc) Info() *interfaces.Info
Info returns some static info about itself.
func (*SystemFunc) Init ¶
func (obj *SystemFunc) Init(init *interfaces.Init) error
Init runs some startup code for this function.
func (*SystemFunc) Stream ¶
func (obj *SystemFunc) Stream(ctx context.Context) error
Stream returns the changing values that this func has over time.
func (*SystemFunc) String ¶
func (obj *SystemFunc) String() string
String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.
func (*SystemFunc) Validate ¶
func (obj *SystemFunc) Validate() error
Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.