modules

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBase64Module

func NewBase64Module() *isopod.Module

NewBase64Module returns a base64 module.

func NewHTTPModule

func NewHTTPModule() *isopod.Module

NewHTTPModule returns new Isopod built-in module for HTTP calls. Supports these methods:

  • http.get - Performs HTTP GET call
  • http.post - Performs HTTP POST call
  • http.put - Performs HTTP PUT call
  • http.patch - Performs HTTP PATCH call
  • http.delete - Performs HTTP DELETE call

Args: url - required URL to send request to. headers - optional headers provided as Starlark dict. Values can be either

Starlark strings (for single value headers) or lists (for multiple
ones).

data - optional data sent in request body (take Starlark string).

Returns: Starlark string of response body. If response body is empty, returns starlark.None.

Errors out on non-2XX response codes.

func NewUUIDModule

func NewUUIDModule() *isopod.Module

NewUUIDModule returns a uuid module.

func Predeclared

func Predeclared() starlark.StringDict

Predeclared returns a starlark.StringDict containing predeclared modules from util:

  • base64 - Base64 encode/decode operations (RFC 4648).
  • uuid - UUID generate operations (RFC 4122).
  • http - HTTP calls.
  • struct - Starlark struct with to_json() support.

func StructFn

func StructFn(t *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

StructFn implements the built-in function that instantiates and extends the starlark struct to support to_json().

func WriteJSON

func WriteJSON(out *bytes.Buffer, v starlark.Value) error

WriteJSON marshals the starlark value to json blob.

Types

type Struct

type Struct struct {
	*starlarkstruct.Struct
}

Struct adds to_json attribute to the starlark struct.

func (*Struct) Attr

func (s *Struct) Attr(name string) (starlark.Value, error)

Attr implements starlark.HasAttrs.Attr.

Jump to

Keyboard shortcuts

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