runtime

package
v0.22.5 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 41 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultExpirationSeconds = 60

Variables

This section is empty.

Functions

func InitCache

func InitCache(c Cache)

func LoadCacheModule

func LoadCacheModule() (starlark.StringDict, error)

func LoadSecretModule added in v0.13.2

func LoadSecretModule() (starlark.StringDict, error)

func LoadXPathModule added in v0.4.3

func LoadXPathModule() (starlark.StringDict, error)

Types

type Applet

type Applet struct {
	Filename            string
	Id                  string
	Globals             starlark.StringDict
	SecretDecryptionKey *SecretDecryptionKey
	// contains filtered or unexported fields
}

func (*Applet) Call

func (a *Applet) Call(callable *starlark.Function, args starlark.Tuple, initializers ...ThreadInitializer) (val starlark.Value, err error)

Calls any callable from Applet.Globals. Pass args and receive a starlark Value, or an error if you're unlucky.

func (*Applet) CallSchemaHandler added in v0.10.0

func (app *Applet) CallSchemaHandler(ctx context.Context, handlerName, parameter string) (result string, err error)

CallSchemaHandler calls a schema handler, passing it a single string parameter and returning a single string value.

func (*Applet) GetSchema added in v0.10.0

func (app *Applet) GetSchema() string

GetSchema returns the config for the applet.

func (*Applet) Load

func (a *Applet) Load(filename string, src []byte, loader ModuleLoader) (err error)

Loads an applet. The script filename is used as a descriptor only, and the actual code should be passed in src. Optionally also pass loader to make additional starlark modules available to the script.

func (*Applet) Run

func (a *Applet) Run(config map[string]string, initializers ...ThreadInitializer) (roots []render.Root, err error)

Runs the applet's main function, passing it configuration as a starlark dict.

type AppletConfig added in v0.12.0

type AppletConfig map[string]string

func (AppletConfig) Attr added in v0.12.0

func (a AppletConfig) Attr(name string) (starlark.Value, error)

func (AppletConfig) AttrNames added in v0.12.0

func (a AppletConfig) AttrNames() []string

func (AppletConfig) Freeze added in v0.12.0

func (a AppletConfig) Freeze()

func (AppletConfig) Get added in v0.12.0

func (AppletConfig) Hash added in v0.12.0

func (a AppletConfig) Hash() (uint32, error)

func (AppletConfig) String added in v0.12.0

func (a AppletConfig) String() string

func (AppletConfig) Truth added in v0.12.0

func (a AppletConfig) Truth() starlark.Bool

func (AppletConfig) Type added in v0.12.0

func (a AppletConfig) Type() string

type Cache

type Cache interface {
	Set(thread *starlark.Thread, key string, value []byte, ttl int64) error
	Get(thread *starlark.Thread, key string) ([]byte, bool, error)
}

type InMemoryCache

type InMemoryCache struct {
	// contains filtered or unexported fields
}

func NewInMemoryCache

func NewInMemoryCache() *InMemoryCache

func (*InMemoryCache) Get

func (c *InMemoryCache) Get(_ *starlark.Thread, key string) (value []byte, found bool, err error)

func (*InMemoryCache) Set

func (c *InMemoryCache) Set(_ *starlark.Thread, key string, value []byte, ttl int64) error

type InMemoryCacheRecord

type InMemoryCacheRecord struct {
	// contains filtered or unexported fields
}

type ModuleLoader

type ModuleLoader func(*starlark.Thread, string) (starlark.StringDict, error)

type SecretDecryptionKey added in v0.13.0

type SecretDecryptionKey struct {
	// EncryptedKeysetJSON is the encrypted JSON representation of a Tink keyset.
	EncryptedKeysetJSON []byte

	// KeyEncryptionKey is a Tink key that can be used to decrypt the keyset.
	KeyEncryptionKey tink.AEAD
}

SecretDecryptionKey is a key that can be used to decrypt secrets.

type SecretEncryptionKey added in v0.13.0

type SecretEncryptionKey struct {
	// PublicKeysetJSON is the serialized JSON representation of a Tink keyset.
	PublicKeysetJSON []byte
}

SecretEncryptionKey is a key that can be used to encrypt secrets, but not decrypt them.

func (*SecretEncryptionKey) Encrypt added in v0.13.0

func (sek *SecretEncryptionKey) Encrypt(appName, plaintext string) (string, error)

Encrypt encrypts a value for use as a secret in an app. Provide both a value and the name of the app the encrypted secret will be used in. The value will only be usable with the specified app.

type ThreadInitializer added in v0.5.1

type ThreadInitializer func(thread *starlark.Thread) *starlark.Thread

ThreadInitializer is called when building a Starlark thread to run an applet on. It can customize the thread by overriding behavior or attaching thread local data.

type XPath added in v0.4.3

type XPath struct {
	// contains filtered or unexported fields
}

func (*XPath) Attr added in v0.4.3

func (x *XPath) Attr(name string) (starlark.Value, error)

func (*XPath) AttrNames added in v0.4.3

func (x *XPath) AttrNames() []string

func (*XPath) Freeze added in v0.4.3

func (x *XPath) Freeze()

func (*XPath) Hash added in v0.4.3

func (x *XPath) Hash() (uint32, error)

func (*XPath) String added in v0.4.3

func (x *XPath) String() string

func (*XPath) Truth added in v0.4.3

func (x *XPath) Truth() starlark.Bool

func (*XPath) Type added in v0.4.3

func (x *XPath) Type() string

Directories

Path Synopsis
modules

Jump to

Keyboard shortcuts

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