riza

package module
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

README

Riza Go API Library

Go Reference

The Riza Go library provides convenient access to the Riza REST API from applications written in Go.

It is generated with Stainless.

Installation

import (
	"github.com/riza-io/riza-api-go" // imported as riza
)

Or to pin the version:

go get -u 'github.com/riza-io/riza-api-go@v0.12.0'

Requirements

This library requires Go 1.18+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/riza-io/riza-api-go"
	"github.com/riza-io/riza-api-go/option"
)

func main() {
	client := riza.NewClient(
		option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("RIZA_API_KEY")
	)
	response, err := client.Command.Exec(context.TODO(), riza.CommandExecParams{
		Code:     riza.F("print('Hello, World!')"),
		Language: riza.F(riza.CommandExecParamsLanguagePython),
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.ID)
}

Request fields

All request parameters are wrapped in a generic Field type, which we use to distinguish zero values from null or omitted fields.

This prevents accidentally sending a zero value if you forget a required parameter, and enables explicitly sending null, false, '', or 0 on optional parameters. Any field not specified is not sent.

To construct fields with values, use the helpers String(), Int(), Float(), or most commonly, the generic F[T](). To send a null, use Null[T](), and to send a nonconforming value, use Raw[T](any). For example:

params := FooParams{
	Name: riza.F("hello"),

	// Explicitly send `"description": null`
	Description: riza.Null[string](),

	Point: riza.F(riza.Point{
		X: riza.Int(0),
		Y: riza.Int(1),

		// In cases where the API specifies a given type,
		// but you want to send something else, use `Raw`:
		Z: riza.Raw[int64](0.01), // sends a float
	}),
}
Response objects

All fields in response structs are value types (not pointers or wrappers).

If a given field is null, not present, or invalid, the corresponding field will simply be its zero value.

All response structs also include a special JSON field, containing more detailed information about each property, which you can use like so:

if res.Name == "" {
	// true if `"name"` is either not present or explicitly null
	res.JSON.Name.IsNull()

	// true if the `"name"` key was not present in the response JSON at all
	res.JSON.Name.IsMissing()

	// When the API returns data that cannot be coerced to the expected type:
	if res.JSON.Name.IsInvalid() {
		raw := res.JSON.Name.Raw()

		legacyName := struct{
			First string `json:"first"`
			Last  string `json:"last"`
		}{}
		json.Unmarshal([]byte(raw), &legacyName)
		name = legacyName.First + " " + legacyName.Last
	}
}

These .JSON structs also include an Extras map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := riza.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Command.Exec(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

Errors

When the API returns a non-success status code, we return an error with type *riza.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Command.Exec(context.TODO(), riza.CommandExecParams{
	Code:     riza.F("print('Hello, World!')"),
	Language: riza.F(riza.CommandExecParamsLanguagePython),
})
if err != nil {
	var apierr *riza.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/v1/execute": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Command.Exec(
	ctx,
	riza.CommandExecParams{
		Code:     riza.F("print('Hello, World!')"),
		Language: riza.F(riza.CommandExecParamsLanguagePython),
	},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as param.Field[io.Reader]. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper riza.FileParam(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := riza.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Command.Exec(
	context.TODO(),
	riza.CommandExecParams{
		Code:     riza.F("print('Hello, World!')"),
		Language: riza.F(riza.CommandExecParamsLanguagePython),
	},
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
response, err := client.Command.Exec(
	context.TODO(),
	riza.CommandExecParams{
		Code:     riza.F("print('Hello, World!')"),
		Language: riza.F(riza.CommandExecParamsLanguagePython),
	},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", response)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]interface{}

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   riza.F("id_xxxx"),
    Data: riza.F(FooNewParamsData{
        FirstName: riza.F("John"),
    }),
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := riza.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(value bool) param.Field[bool]

Bool is a param field helper which helps specify bools.

func DefaultClientOptions added in v0.10.0

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (RIZA_API_KEY, RIZA_BASE_URL). This should be used to initialize new clients.

func F

func F[T any](value T) param.Field[T]

F is a param field helper used to initialize a param.Field generic struct. This helps specify null, zero values, and overrides, as well as normal values. You can read more about this in our README.

func FileParam

func FileParam(reader io.Reader, filename string, contentType string) param.Field[io.Reader]

FileParam is a param field helper which helps files with a mime content-type.

func Float

func Float(value float64) param.Field[float64]

Float is a param field helper which helps specify floats.

func Int

func Int(value int64) param.Field[int64]

Int is a param field helper which helps specify integers. This is particularly helpful when specifying integer constants for fields.

func Null

func Null[T any]() param.Field[T]

Null is a param field helper which explicitly sends null to the API.

func Raw

func Raw[T any](value any) param.Field[T]

Raw is a param field helper for specifying values for fields when the type you are looking to send is different from the type that is specified in the SDK. For example, if the type of the field is an integer, but you want to send a float, you could do that by setting the corresponding field with Raw[int](0.5).

func String

func String(value string) param.Field[string]

String is a param field helper which helps specify strings.

Types

type Client

type Client struct {
	Options    []option.RequestOption
	Secrets    *SecretService
	Tools      *ToolService
	Command    *CommandService
	Runtimes   *RuntimeService
	Executions *ExecutionService
}

Client creates a struct with services and top level methods that help with interacting with the riza API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r *Client)

NewClient generates a new client with the default option read from the environment (RIZA_API_KEY, RIZA_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type CommandExecFuncParams added in v0.7.0

type CommandExecFuncParams struct {
	// The function to execute. Your code must define a function named "execute" that
	// takes in a single argument and returns a JSON-serializable value.
	Code param.Field[string] `json:"code,required"`
	// The interpreter to use when executing code.
	Language param.Field[CommandExecFuncParamsLanguage] `json:"language,required"`
	// Set of key-value pairs to add to the function's execution environment.
	Env param.Field[map[string]string] `json:"env"`
	// List of input files.
	Files param.Field[[]CommandExecFuncParamsFile] `json:"files"`
	// Configuration for HTTP requests and authentication.
	HTTP param.Field[CommandExecFuncParamsHTTP] `json:"http"`
	// The input to the function. This must be a valid JSON-serializable object. If you
	// do not pass an input, your function will be called with None (Python) or null
	// (JavaScript/TypeScript) as the argument.
	Input param.Field[interface{}] `json:"input"`
	// Configuration for execution environment limits.
	Limits param.Field[CommandExecFuncParamsLimits] `json:"limits"`
	// The ID of the runtime revision to use when executing code.
	RuntimeRevisionID param.Field[string] `json:"runtime_revision_id"`
}

func (CommandExecFuncParams) MarshalJSON added in v0.7.0

func (r CommandExecFuncParams) MarshalJSON() (data []byte, err error)

type CommandExecFuncParamsFile added in v0.7.0

type CommandExecFuncParamsFile struct {
	// The contents of the file.
	Contents param.Field[string] `json:"contents"`
	// The relative path of the file.
	Path param.Field[string] `json:"path"`
}

func (CommandExecFuncParamsFile) MarshalJSON added in v0.7.0

func (r CommandExecFuncParamsFile) MarshalJSON() (data []byte, err error)

type CommandExecFuncParamsHTTP added in v0.7.0

type CommandExecFuncParamsHTTP struct {
	// List of allowed HTTP hosts and associated authentication.
	Allow param.Field[[]CommandExecFuncParamsHTTPAllow] `json:"allow"`
}

Configuration for HTTP requests and authentication.

func (CommandExecFuncParamsHTTP) MarshalJSON added in v0.7.0

func (r CommandExecFuncParamsHTTP) MarshalJSON() (data []byte, err error)

type CommandExecFuncParamsHTTPAllow added in v0.7.0

type CommandExecFuncParamsHTTPAllow struct {
	// Authentication configuration for outbound requests to this host.
	Auth param.Field[CommandExecFuncParamsHTTPAllowAuth] `json:"auth"`
	// The hostname to allow.
	Host param.Field[string] `json:"host"`
}

List of allowed HTTP hosts and associated authentication.

func (CommandExecFuncParamsHTTPAllow) MarshalJSON added in v0.7.0

func (r CommandExecFuncParamsHTTPAllow) MarshalJSON() (data []byte, err error)

type CommandExecFuncParamsHTTPAllowAuth added in v0.7.0

type CommandExecFuncParamsHTTPAllowAuth struct {
	Basic param.Field[CommandExecFuncParamsHTTPAllowAuthBasic] `json:"basic"`
	// Configuration to add an 'Authorization' header using the 'Bearer' scheme.
	Bearer param.Field[CommandExecFuncParamsHTTPAllowAuthBearer] `json:"bearer"`
	Header param.Field[CommandExecFuncParamsHTTPAllowAuthHeader] `json:"header"`
	Query  param.Field[CommandExecFuncParamsHTTPAllowAuthQuery]  `json:"query"`
}

Authentication configuration for outbound requests to this host.

func (CommandExecFuncParamsHTTPAllowAuth) MarshalJSON added in v0.7.0

func (r CommandExecFuncParamsHTTPAllowAuth) MarshalJSON() (data []byte, err error)

type CommandExecFuncParamsHTTPAllowAuthBasic added in v0.7.0

type CommandExecFuncParamsHTTPAllowAuthBasic struct {
	Password param.Field[string] `json:"password"`
	UserID   param.Field[string] `json:"user_id"`
}

func (CommandExecFuncParamsHTTPAllowAuthBasic) MarshalJSON added in v0.7.0

func (r CommandExecFuncParamsHTTPAllowAuthBasic) MarshalJSON() (data []byte, err error)

type CommandExecFuncParamsHTTPAllowAuthBearer added in v0.7.0

type CommandExecFuncParamsHTTPAllowAuthBearer struct {
	// The token to set, e.g. 'Authorization: Bearer <token>'.
	Token param.Field[string] `json:"token"`
}

Configuration to add an 'Authorization' header using the 'Bearer' scheme.

func (CommandExecFuncParamsHTTPAllowAuthBearer) MarshalJSON added in v0.7.0

func (r CommandExecFuncParamsHTTPAllowAuthBearer) MarshalJSON() (data []byte, err error)

type CommandExecFuncParamsHTTPAllowAuthHeader added in v0.7.0

type CommandExecFuncParamsHTTPAllowAuthHeader struct {
	Name  param.Field[string] `json:"name"`
	Value param.Field[string] `json:"value"`
}

func (CommandExecFuncParamsHTTPAllowAuthHeader) MarshalJSON added in v0.7.0

func (r CommandExecFuncParamsHTTPAllowAuthHeader) MarshalJSON() (data []byte, err error)

type CommandExecFuncParamsHTTPAllowAuthQuery added in v0.7.0

type CommandExecFuncParamsHTTPAllowAuthQuery struct {
	Key   param.Field[string] `json:"key"`
	Value param.Field[string] `json:"value"`
}

func (CommandExecFuncParamsHTTPAllowAuthQuery) MarshalJSON added in v0.7.0

func (r CommandExecFuncParamsHTTPAllowAuthQuery) MarshalJSON() (data []byte, err error)

type CommandExecFuncParamsLanguage added in v0.7.0

type CommandExecFuncParamsLanguage string

The interpreter to use when executing code.

const (
	CommandExecFuncParamsLanguagePython     CommandExecFuncParamsLanguage = "python"
	CommandExecFuncParamsLanguageJavascript CommandExecFuncParamsLanguage = "javascript"
	CommandExecFuncParamsLanguageTypescript CommandExecFuncParamsLanguage = "typescript"
)

func (CommandExecFuncParamsLanguage) IsKnown added in v0.7.0

func (r CommandExecFuncParamsLanguage) IsKnown() bool

type CommandExecFuncParamsLimits added in v0.7.0

type CommandExecFuncParamsLimits struct {
	// The maximum time allowed for execution (in seconds). Default is 30.
	ExecutionTimeout param.Field[int64] `json:"execution_timeout"`
	// The maximum memory allowed for execution (in MiB). Default is 128.
	MemorySize param.Field[int64] `json:"memory_size"`
}

Configuration for execution environment limits.

func (CommandExecFuncParamsLimits) MarshalJSON added in v0.7.0

func (r CommandExecFuncParamsLimits) MarshalJSON() (data []byte, err error)

type CommandExecFuncResponse added in v0.7.0

type CommandExecFuncResponse struct {
	// The execution details of the function.
	Execution CommandExecFuncResponseExecution `json:"execution,required"`
	// The output of the function.
	Output interface{} `json:"output,required"`
	// The status of the output. "valid" means your function executed successfully and
	// returned a valid JSON-serializable object, or void. "json_serialization_error"
	// means your function executed successfully, but returned a nonserializable
	// object. "error" means your function failed to execute.
	OutputStatus CommandExecFuncResponseOutputStatus `json:"output_status,required"`
	JSON         commandExecFuncResponseJSON         `json:"-"`
}

func (*CommandExecFuncResponse) UnmarshalJSON added in v0.7.0

func (r *CommandExecFuncResponse) UnmarshalJSON(data []byte) (err error)

type CommandExecFuncResponseExecution added in v0.7.0

type CommandExecFuncResponseExecution struct {
	// The ID of the execution.
	ID string `json:"id,required"`
	// The execution time of the function in milliseconds.
	Duration int64 `json:"duration,required"`
	// The exit code returned by the function. Will often be '0' on success and
	// non-zero on failure.
	ExitCode int64 `json:"exit_code,required"`
	// The contents of 'stderr' after executing the function.
	Stderr string `json:"stderr,required"`
	// The contents of 'stdout' after executing the function.
	Stdout string                               `json:"stdout,required"`
	JSON   commandExecFuncResponseExecutionJSON `json:"-"`
}

The execution details of the function.

func (*CommandExecFuncResponseExecution) UnmarshalJSON added in v0.7.0

func (r *CommandExecFuncResponseExecution) UnmarshalJSON(data []byte) (err error)

type CommandExecFuncResponseOutputStatus added in v0.7.0

type CommandExecFuncResponseOutputStatus string

The status of the output. "valid" means your function executed successfully and returned a valid JSON-serializable object, or void. "json_serialization_error" means your function executed successfully, but returned a nonserializable object. "error" means your function failed to execute.

const (
	CommandExecFuncResponseOutputStatusError                  CommandExecFuncResponseOutputStatus = "error"
	CommandExecFuncResponseOutputStatusJsonSerializationError CommandExecFuncResponseOutputStatus = "json_serialization_error"
	CommandExecFuncResponseOutputStatusValid                  CommandExecFuncResponseOutputStatus = "valid"
)

func (CommandExecFuncResponseOutputStatus) IsKnown added in v0.7.0

type CommandExecParams

type CommandExecParams struct {
	// The code to execute.
	Code param.Field[string] `json:"code,required"`
	// The interpreter to use when executing code.
	Language param.Field[CommandExecParamsLanguage] `json:"language,required"`
	// List of command line arguments to pass to the script.
	Args param.Field[[]string] `json:"args"`
	// Set of key-value pairs to add to the script's execution environment.
	Env param.Field[map[string]string] `json:"env"`
	// List of input files.
	Files param.Field[[]CommandExecParamsFile] `json:"files"`
	// Configuration for HTTP requests and authentication.
	HTTP param.Field[CommandExecParamsHTTP] `json:"http"`
	// Configuration for execution environment limits.
	Limits param.Field[CommandExecParamsLimits] `json:"limits"`
	// The ID of the runtime revision to use when executing code.
	RuntimeRevisionID param.Field[string] `json:"runtime_revision_id"`
	// Input made available to the script via 'stdin'.
	Stdin param.Field[string] `json:"stdin"`
}

func (CommandExecParams) MarshalJSON

func (r CommandExecParams) MarshalJSON() (data []byte, err error)

type CommandExecParamsFile

type CommandExecParamsFile struct {
	// The contents of the file.
	Contents param.Field[string] `json:"contents"`
	// The relative path of the file.
	Path param.Field[string] `json:"path"`
}

func (CommandExecParamsFile) MarshalJSON

func (r CommandExecParamsFile) MarshalJSON() (data []byte, err error)

type CommandExecParamsHTTP

type CommandExecParamsHTTP struct {
	// List of allowed HTTP hosts and associated authentication.
	Allow param.Field[[]CommandExecParamsHTTPAllow] `json:"allow"`
}

Configuration for HTTP requests and authentication.

func (CommandExecParamsHTTP) MarshalJSON

func (r CommandExecParamsHTTP) MarshalJSON() (data []byte, err error)

type CommandExecParamsHTTPAllow

type CommandExecParamsHTTPAllow struct {
	// Authentication configuration for outbound requests to this host.
	Auth param.Field[CommandExecParamsHTTPAllowAuth] `json:"auth"`
	// The hostname to allow.
	Host param.Field[string] `json:"host"`
}

List of allowed HTTP hosts and associated authentication.

func (CommandExecParamsHTTPAllow) MarshalJSON

func (r CommandExecParamsHTTPAllow) MarshalJSON() (data []byte, err error)

type CommandExecParamsHTTPAllowAuth

type CommandExecParamsHTTPAllowAuth struct {
	Basic param.Field[CommandExecParamsHTTPAllowAuthBasic] `json:"basic"`
	// Configuration to add an 'Authorization' header using the 'Bearer' scheme.
	Bearer param.Field[CommandExecParamsHTTPAllowAuthBearer] `json:"bearer"`
	Header param.Field[CommandExecParamsHTTPAllowAuthHeader] `json:"header"`
	Query  param.Field[CommandExecParamsHTTPAllowAuthQuery]  `json:"query"`
}

Authentication configuration for outbound requests to this host.

func (CommandExecParamsHTTPAllowAuth) MarshalJSON

func (r CommandExecParamsHTTPAllowAuth) MarshalJSON() (data []byte, err error)

type CommandExecParamsHTTPAllowAuthBasic

type CommandExecParamsHTTPAllowAuthBasic struct {
	Password param.Field[string] `json:"password"`
	UserID   param.Field[string] `json:"user_id"`
}

func (CommandExecParamsHTTPAllowAuthBasic) MarshalJSON

func (r CommandExecParamsHTTPAllowAuthBasic) MarshalJSON() (data []byte, err error)

type CommandExecParamsHTTPAllowAuthBearer

type CommandExecParamsHTTPAllowAuthBearer struct {
	// The token to set, e.g. 'Authorization: Bearer <token>'.
	Token param.Field[string] `json:"token"`
}

Configuration to add an 'Authorization' header using the 'Bearer' scheme.

func (CommandExecParamsHTTPAllowAuthBearer) MarshalJSON

func (r CommandExecParamsHTTPAllowAuthBearer) MarshalJSON() (data []byte, err error)

type CommandExecParamsHTTPAllowAuthHeader

type CommandExecParamsHTTPAllowAuthHeader struct {
	Name  param.Field[string] `json:"name"`
	Value param.Field[string] `json:"value"`
}

func (CommandExecParamsHTTPAllowAuthHeader) MarshalJSON

func (r CommandExecParamsHTTPAllowAuthHeader) MarshalJSON() (data []byte, err error)

type CommandExecParamsHTTPAllowAuthQuery

type CommandExecParamsHTTPAllowAuthQuery struct {
	Key   param.Field[string] `json:"key"`
	Value param.Field[string] `json:"value"`
}

func (CommandExecParamsHTTPAllowAuthQuery) MarshalJSON

func (r CommandExecParamsHTTPAllowAuthQuery) MarshalJSON() (data []byte, err error)

type CommandExecParamsLanguage

type CommandExecParamsLanguage string

The interpreter to use when executing code.

const (
	CommandExecParamsLanguagePython     CommandExecParamsLanguage = "python"
	CommandExecParamsLanguageJavascript CommandExecParamsLanguage = "javascript"
	CommandExecParamsLanguageTypescript CommandExecParamsLanguage = "typescript"
	CommandExecParamsLanguageRuby       CommandExecParamsLanguage = "ruby"
	CommandExecParamsLanguagePhp        CommandExecParamsLanguage = "php"
)

func (CommandExecParamsLanguage) IsKnown

func (r CommandExecParamsLanguage) IsKnown() bool

type CommandExecParamsLimits

type CommandExecParamsLimits struct {
	// The maximum time allowed for execution (in seconds). Default is 30.
	ExecutionTimeout param.Field[int64] `json:"execution_timeout"`
	// The maximum memory allowed for execution (in MiB). Default is 128.
	MemorySize param.Field[int64] `json:"memory_size"`
}

Configuration for execution environment limits.

func (CommandExecParamsLimits) MarshalJSON

func (r CommandExecParamsLimits) MarshalJSON() (data []byte, err error)

type CommandExecResponse

type CommandExecResponse struct {
	// The ID of the execution.
	ID string `json:"id,required"`
	// The execution time of the script in milliseconds.
	Duration int64 `json:"duration,required"`
	// The exit code returned by the script. Will often be '0' on success and non-zero
	// on failure.
	ExitCode int64 `json:"exit_code,required"`
	// The contents of 'stderr' after executing the script.
	Stderr string `json:"stderr,required"`
	// The contents of 'stdout' after executing the script.
	Stdout string                  `json:"stdout,required"`
	JSON   commandExecResponseJSON `json:"-"`
}

func (*CommandExecResponse) UnmarshalJSON

func (r *CommandExecResponse) UnmarshalJSON(data []byte) (err error)

type CommandService

type CommandService struct {
	Options []option.RequestOption
}

CommandService contains methods and other services that help with interacting with the riza API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCommandService method instead.

func NewCommandService

func NewCommandService(opts ...option.RequestOption) (r *CommandService)

NewCommandService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CommandService) Exec

Run a script in a secure, isolated environment. Scripts can read from `stdin` and write to `stdout` or `stderr`. They can access input files, environment variables and command line arguments.

func (*CommandService) ExecFunc added in v0.7.0

Run a function in a secure, isolated environment. Define a function named `execute`. The function will be passed `input` as an object.

type Error

type Error = apierror.Error

type Execution added in v0.12.0

type Execution struct {
	ID        string            `json:"id,required"`
	Duration  int64             `json:"duration,required"`
	ExitCode  int64             `json:"exit_code,required"`
	Language  ExecutionLanguage `json:"language,required"`
	StartedAt time.Time         `json:"started_at,required" format:"date-time"`
	Details   ExecutionDetails  `json:"details"`
	JSON      executionJSON     `json:"-"`
}

func (*Execution) UnmarshalJSON added in v0.12.0

func (r *Execution) UnmarshalJSON(data []byte) (err error)

type ExecutionDetails added in v0.12.0

type ExecutionDetails struct {
	// This field can have the runtime type of
	// [ExecutionDetailsToolExecutionDetailsRequest],
	// [ExecutionDetailsFunctionExecutionDetailsRequest],
	// [ExecutionDetailsScriptExecutionDetailsRequest].
	Request interface{} `json:"request,required"`
	// This field can have the runtime type of
	// [ExecutionDetailsToolExecutionDetailsResponse],
	// [ExecutionDetailsFunctionExecutionDetailsResponse],
	// [ExecutionDetailsScriptExecutionDetailsResponse].
	Response interface{}          `json:"response,required"`
	Type     ExecutionDetailsType `json:"type,required"`
	ToolID   string               `json:"tool_id"`
	JSON     executionDetailsJSON `json:"-"`
	// contains filtered or unexported fields
}

func (ExecutionDetails) AsUnion added in v0.12.0

AsUnion returns a ExecutionDetailsUnion interface which you can cast to the specific types for more type safety.

Possible runtime types of the union are ExecutionDetailsToolExecutionDetails, ExecutionDetailsFunctionExecutionDetails, ExecutionDetailsScriptExecutionDetails.

func (*ExecutionDetails) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetails) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsFunctionExecutionDetails added in v0.12.0

type ExecutionDetailsFunctionExecutionDetails struct {
	Request  ExecutionDetailsFunctionExecutionDetailsRequest  `json:"request,required"`
	Response ExecutionDetailsFunctionExecutionDetailsResponse `json:"response,required"`
	Type     ExecutionDetailsFunctionExecutionDetailsType     `json:"type,required"`
	JSON     executionDetailsFunctionExecutionDetailsJSON     `json:"-"`
}

func (*ExecutionDetailsFunctionExecutionDetails) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsFunctionExecutionDetails) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsFunctionExecutionDetailsRequest added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequest struct {
	// The function to execute. Your code must define a function named "execute" that
	// takes in a single argument and returns a JSON-serializable value.
	Code string `json:"code,required"`
	// The interpreter to use when executing code.
	Language ExecutionDetailsFunctionExecutionDetailsRequestLanguage `json:"language,required"`
	// Set of key-value pairs to add to the function's execution environment.
	Env map[string]string `json:"env"`
	// List of input files.
	Files []ExecutionDetailsFunctionExecutionDetailsRequestFile `json:"files"`
	// Configuration for HTTP requests and authentication.
	HTTP ExecutionDetailsFunctionExecutionDetailsRequestHTTP `json:"http"`
	// The input to the function. This must be a valid JSON-serializable object. If you
	// do not pass an input, your function will be called with None (Python) or null
	// (JavaScript/TypeScript) as the argument.
	Input interface{} `json:"input"`
	// Configuration for execution environment limits.
	Limits ExecutionDetailsFunctionExecutionDetailsRequestLimits `json:"limits"`
	// The ID of the runtime revision to use when executing code.
	RuntimeRevisionID string                                              `json:"runtime_revision_id"`
	JSON              executionDetailsFunctionExecutionDetailsRequestJSON `json:"-"`
}

func (*ExecutionDetailsFunctionExecutionDetailsRequest) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsFunctionExecutionDetailsRequest) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsFunctionExecutionDetailsRequestFile added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequestFile struct {
	// The contents of the file.
	Contents string `json:"contents"`
	// The relative path of the file.
	Path string                                                  `json:"path"`
	JSON executionDetailsFunctionExecutionDetailsRequestFileJSON `json:"-"`
}

func (*ExecutionDetailsFunctionExecutionDetailsRequestFile) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsFunctionExecutionDetailsRequestFile) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsFunctionExecutionDetailsRequestHTTP added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequestHTTP struct {
	// List of allowed HTTP hosts and associated authentication.
	Allow []ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllow `json:"allow"`
	JSON  executionDetailsFunctionExecutionDetailsRequestHTTPJSON    `json:"-"`
}

Configuration for HTTP requests and authentication.

func (*ExecutionDetailsFunctionExecutionDetailsRequestHTTP) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsFunctionExecutionDetailsRequestHTTP) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllow added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllow struct {
	// Authentication configuration for outbound requests to this host.
	Auth ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuth `json:"auth"`
	// The hostname to allow.
	Host string                                                       `json:"host"`
	JSON executionDetailsFunctionExecutionDetailsRequestHTTPAllowJSON `json:"-"`
}

List of allowed HTTP hosts and associated authentication.

func (*ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllow) UnmarshalJSON added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuth added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuth struct {
	Basic ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthBasic `json:"basic"`
	// Configuration to add an 'Authorization' header using the 'Bearer' scheme.
	Bearer ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthBearer `json:"bearer"`
	Header ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthHeader `json:"header"`
	Query  ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthQuery  `json:"query"`
	JSON   executionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthJSON   `json:"-"`
}

Authentication configuration for outbound requests to this host.

func (*ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuth) UnmarshalJSON added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthBasic added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthBasic struct {
	Password string                                                                `json:"password"`
	UserID   string                                                                `json:"user_id"`
	JSON     executionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthBasicJSON `json:"-"`
}

func (*ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthBasic) UnmarshalJSON added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthBearer added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthBearer struct {
	// The token to set, e.g. 'Authorization: Bearer <token>'.
	Token string                                                                 `json:"token"`
	JSON  executionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthBearerJSON `json:"-"`
}

Configuration to add an 'Authorization' header using the 'Bearer' scheme.

func (*ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthBearer) UnmarshalJSON added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthHeader added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthHeader struct {
	Name  string                                                                 `json:"name"`
	Value string                                                                 `json:"value"`
	JSON  executionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthHeaderJSON `json:"-"`
}

func (*ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthHeader) UnmarshalJSON added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthQuery added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthQuery struct {
	Key   string                                                                `json:"key"`
	Value string                                                                `json:"value"`
	JSON  executionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthQueryJSON `json:"-"`
}

func (*ExecutionDetailsFunctionExecutionDetailsRequestHTTPAllowAuthQuery) UnmarshalJSON added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequestLanguage added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequestLanguage string

The interpreter to use when executing code.

const (
	ExecutionDetailsFunctionExecutionDetailsRequestLanguagePython     ExecutionDetailsFunctionExecutionDetailsRequestLanguage = "python"
	ExecutionDetailsFunctionExecutionDetailsRequestLanguageJavascript ExecutionDetailsFunctionExecutionDetailsRequestLanguage = "javascript"
	ExecutionDetailsFunctionExecutionDetailsRequestLanguageTypescript ExecutionDetailsFunctionExecutionDetailsRequestLanguage = "typescript"
)

func (ExecutionDetailsFunctionExecutionDetailsRequestLanguage) IsKnown added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequestLimits added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsRequestLimits struct {
	// The maximum time allowed for execution (in seconds). Default is 30.
	ExecutionTimeout int64 `json:"execution_timeout"`
	// The maximum memory allowed for execution (in MiB). Default is 128.
	MemorySize int64                                                     `json:"memory_size"`
	JSON       executionDetailsFunctionExecutionDetailsRequestLimitsJSON `json:"-"`
}

Configuration for execution environment limits.

func (*ExecutionDetailsFunctionExecutionDetailsRequestLimits) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsFunctionExecutionDetailsRequestLimits) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsFunctionExecutionDetailsResponse added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsResponse struct {
	// The execution details of the function.
	Execution ExecutionDetailsFunctionExecutionDetailsResponseExecution `json:"execution,required"`
	// The output of the function.
	Output interface{} `json:"output,required"`
	// The status of the output. "valid" means your function executed successfully and
	// returned a valid JSON-serializable object, or void. "json_serialization_error"
	// means your function executed successfully, but returned a nonserializable
	// object. "error" means your function failed to execute.
	OutputStatus ExecutionDetailsFunctionExecutionDetailsResponseOutputStatus `json:"output_status,required"`
	JSON         executionDetailsFunctionExecutionDetailsResponseJSON         `json:"-"`
}

func (*ExecutionDetailsFunctionExecutionDetailsResponse) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsFunctionExecutionDetailsResponse) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsFunctionExecutionDetailsResponseExecution added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsResponseExecution struct {
	// The ID of the execution.
	ID string `json:"id,required"`
	// The execution time of the function in milliseconds.
	Duration int64 `json:"duration,required"`
	// The exit code returned by the function. Will often be '0' on success and
	// non-zero on failure.
	ExitCode int64 `json:"exit_code,required"`
	// The contents of 'stderr' after executing the function.
	Stderr string `json:"stderr,required"`
	// The contents of 'stdout' after executing the function.
	Stdout string                                                        `json:"stdout,required"`
	JSON   executionDetailsFunctionExecutionDetailsResponseExecutionJSON `json:"-"`
}

The execution details of the function.

func (*ExecutionDetailsFunctionExecutionDetailsResponseExecution) UnmarshalJSON added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsResponseOutputStatus added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsResponseOutputStatus string

The status of the output. "valid" means your function executed successfully and returned a valid JSON-serializable object, or void. "json_serialization_error" means your function executed successfully, but returned a nonserializable object. "error" means your function failed to execute.

const (
	ExecutionDetailsFunctionExecutionDetailsResponseOutputStatusError                  ExecutionDetailsFunctionExecutionDetailsResponseOutputStatus = "error"
	ExecutionDetailsFunctionExecutionDetailsResponseOutputStatusJsonSerializationError ExecutionDetailsFunctionExecutionDetailsResponseOutputStatus = "json_serialization_error"
	ExecutionDetailsFunctionExecutionDetailsResponseOutputStatusValid                  ExecutionDetailsFunctionExecutionDetailsResponseOutputStatus = "valid"
)

func (ExecutionDetailsFunctionExecutionDetailsResponseOutputStatus) IsKnown added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsType added in v0.12.0

type ExecutionDetailsFunctionExecutionDetailsType string
const (
	ExecutionDetailsFunctionExecutionDetailsTypeFunction ExecutionDetailsFunctionExecutionDetailsType = "function"
)

func (ExecutionDetailsFunctionExecutionDetailsType) IsKnown added in v0.12.0

type ExecutionDetailsScriptExecutionDetails added in v0.12.0

type ExecutionDetailsScriptExecutionDetails struct {
	Request  ExecutionDetailsScriptExecutionDetailsRequest  `json:"request,required"`
	Response ExecutionDetailsScriptExecutionDetailsResponse `json:"response,required"`
	Type     ExecutionDetailsScriptExecutionDetailsType     `json:"type,required"`
	JSON     executionDetailsScriptExecutionDetailsJSON     `json:"-"`
}

func (*ExecutionDetailsScriptExecutionDetails) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsScriptExecutionDetails) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsScriptExecutionDetailsRequest added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsRequest struct {
	// The code to execute.
	Code string `json:"code,required"`
	// The interpreter to use when executing code.
	Language ExecutionDetailsScriptExecutionDetailsRequestLanguage `json:"language,required"`
	// List of command line arguments to pass to the script.
	Args []string `json:"args"`
	// Set of key-value pairs to add to the script's execution environment.
	Env map[string]string `json:"env"`
	// List of input files.
	Files []ExecutionDetailsScriptExecutionDetailsRequestFile `json:"files"`
	// Configuration for HTTP requests and authentication.
	HTTP ExecutionDetailsScriptExecutionDetailsRequestHTTP `json:"http"`
	// Configuration for execution environment limits.
	Limits ExecutionDetailsScriptExecutionDetailsRequestLimits `json:"limits"`
	// The ID of the runtime revision to use when executing code.
	RuntimeRevisionID string `json:"runtime_revision_id"`
	// Input made available to the script via 'stdin'.
	Stdin string                                            `json:"stdin"`
	JSON  executionDetailsScriptExecutionDetailsRequestJSON `json:"-"`
}

func (*ExecutionDetailsScriptExecutionDetailsRequest) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsScriptExecutionDetailsRequest) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsScriptExecutionDetailsRequestFile added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsRequestFile struct {
	// The contents of the file.
	Contents string `json:"contents"`
	// The relative path of the file.
	Path string                                                `json:"path"`
	JSON executionDetailsScriptExecutionDetailsRequestFileJSON `json:"-"`
}

func (*ExecutionDetailsScriptExecutionDetailsRequestFile) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsScriptExecutionDetailsRequestFile) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsScriptExecutionDetailsRequestHTTP added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsRequestHTTP struct {
	// List of allowed HTTP hosts and associated authentication.
	Allow []ExecutionDetailsScriptExecutionDetailsRequestHTTPAllow `json:"allow"`
	JSON  executionDetailsScriptExecutionDetailsRequestHTTPJSON    `json:"-"`
}

Configuration for HTTP requests and authentication.

func (*ExecutionDetailsScriptExecutionDetailsRequestHTTP) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsScriptExecutionDetailsRequestHTTP) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsScriptExecutionDetailsRequestHTTPAllow added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsRequestHTTPAllow struct {
	// Authentication configuration for outbound requests to this host.
	Auth ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuth `json:"auth"`
	// The hostname to allow.
	Host string                                                     `json:"host"`
	JSON executionDetailsScriptExecutionDetailsRequestHTTPAllowJSON `json:"-"`
}

List of allowed HTTP hosts and associated authentication.

func (*ExecutionDetailsScriptExecutionDetailsRequestHTTPAllow) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsScriptExecutionDetailsRequestHTTPAllow) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuth added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuth struct {
	Basic ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuthBasic `json:"basic"`
	// Configuration to add an 'Authorization' header using the 'Bearer' scheme.
	Bearer ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuthBearer `json:"bearer"`
	Header ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuthHeader `json:"header"`
	Query  ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuthQuery  `json:"query"`
	JSON   executionDetailsScriptExecutionDetailsRequestHTTPAllowAuthJSON   `json:"-"`
}

Authentication configuration for outbound requests to this host.

func (*ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuth) UnmarshalJSON added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuthBasic added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuthBasic struct {
	Password string                                                              `json:"password"`
	UserID   string                                                              `json:"user_id"`
	JSON     executionDetailsScriptExecutionDetailsRequestHTTPAllowAuthBasicJSON `json:"-"`
}

func (*ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuthBasic) UnmarshalJSON added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuthBearer added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuthBearer struct {
	// The token to set, e.g. 'Authorization: Bearer <token>'.
	Token string                                                               `json:"token"`
	JSON  executionDetailsScriptExecutionDetailsRequestHTTPAllowAuthBearerJSON `json:"-"`
}

Configuration to add an 'Authorization' header using the 'Bearer' scheme.

func (*ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuthBearer) UnmarshalJSON added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuthHeader added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuthHeader struct {
	Name  string                                                               `json:"name"`
	Value string                                                               `json:"value"`
	JSON  executionDetailsScriptExecutionDetailsRequestHTTPAllowAuthHeaderJSON `json:"-"`
}

func (*ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuthHeader) UnmarshalJSON added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuthQuery added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuthQuery struct {
	Key   string                                                              `json:"key"`
	Value string                                                              `json:"value"`
	JSON  executionDetailsScriptExecutionDetailsRequestHTTPAllowAuthQueryJSON `json:"-"`
}

func (*ExecutionDetailsScriptExecutionDetailsRequestHTTPAllowAuthQuery) UnmarshalJSON added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsRequestLanguage added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsRequestLanguage string

The interpreter to use when executing code.

const (
	ExecutionDetailsScriptExecutionDetailsRequestLanguagePython     ExecutionDetailsScriptExecutionDetailsRequestLanguage = "python"
	ExecutionDetailsScriptExecutionDetailsRequestLanguageJavascript ExecutionDetailsScriptExecutionDetailsRequestLanguage = "javascript"
	ExecutionDetailsScriptExecutionDetailsRequestLanguageTypescript ExecutionDetailsScriptExecutionDetailsRequestLanguage = "typescript"
	ExecutionDetailsScriptExecutionDetailsRequestLanguageRuby       ExecutionDetailsScriptExecutionDetailsRequestLanguage = "ruby"
	ExecutionDetailsScriptExecutionDetailsRequestLanguagePhp        ExecutionDetailsScriptExecutionDetailsRequestLanguage = "php"
)

func (ExecutionDetailsScriptExecutionDetailsRequestLanguage) IsKnown added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsRequestLimits added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsRequestLimits struct {
	// The maximum time allowed for execution (in seconds). Default is 30.
	ExecutionTimeout int64 `json:"execution_timeout"`
	// The maximum memory allowed for execution (in MiB). Default is 128.
	MemorySize int64                                                   `json:"memory_size"`
	JSON       executionDetailsScriptExecutionDetailsRequestLimitsJSON `json:"-"`
}

Configuration for execution environment limits.

func (*ExecutionDetailsScriptExecutionDetailsRequestLimits) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsScriptExecutionDetailsRequestLimits) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsScriptExecutionDetailsResponse added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsResponse struct {
	// The ID of the execution.
	ID string `json:"id,required"`
	// The execution time of the script in milliseconds.
	Duration int64 `json:"duration,required"`
	// The exit code returned by the script. Will often be '0' on success and non-zero
	// on failure.
	ExitCode int64 `json:"exit_code,required"`
	// The contents of 'stderr' after executing the script.
	Stderr string `json:"stderr,required"`
	// The contents of 'stdout' after executing the script.
	Stdout string                                             `json:"stdout,required"`
	JSON   executionDetailsScriptExecutionDetailsResponseJSON `json:"-"`
}

func (*ExecutionDetailsScriptExecutionDetailsResponse) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsScriptExecutionDetailsResponse) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsScriptExecutionDetailsType added in v0.12.0

type ExecutionDetailsScriptExecutionDetailsType string
const (
	ExecutionDetailsScriptExecutionDetailsTypeScript ExecutionDetailsScriptExecutionDetailsType = "script"
)

func (ExecutionDetailsScriptExecutionDetailsType) IsKnown added in v0.12.0

type ExecutionDetailsToolExecutionDetails added in v0.12.0

type ExecutionDetailsToolExecutionDetails struct {
	Request  ExecutionDetailsToolExecutionDetailsRequest  `json:"request,required"`
	Response ExecutionDetailsToolExecutionDetailsResponse `json:"response,required"`
	ToolID   string                                       `json:"tool_id,required"`
	Type     ExecutionDetailsToolExecutionDetailsType     `json:"type,required"`
	JSON     executionDetailsToolExecutionDetailsJSON     `json:"-"`
}

func (*ExecutionDetailsToolExecutionDetails) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsToolExecutionDetails) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsToolExecutionDetailsRequest added in v0.12.0

type ExecutionDetailsToolExecutionDetailsRequest struct {
	// Set of key-value pairs to add to the tool's execution environment.
	Env []ExecutionDetailsToolExecutionDetailsRequestEnv `json:"env"`
	// Configuration for HTTP requests and authentication.
	HTTP ExecutionDetailsToolExecutionDetailsRequestHTTP `json:"http"`
	// The input to the tool. This must be a valid JSON-serializable object. It will be
	// validated against the tool's input schema.
	Input interface{} `json:"input"`
	// The Tool revision ID to execute. This optional parmeter is used to pin
	// executions to specific versions of the Tool. If not provided, the latest
	// (current) version of the Tool will be executed.
	RevisionID string                                          `json:"revision_id"`
	JSON       executionDetailsToolExecutionDetailsRequestJSON `json:"-"`
}

func (*ExecutionDetailsToolExecutionDetailsRequest) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsToolExecutionDetailsRequest) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsToolExecutionDetailsRequestEnv added in v0.12.0

type ExecutionDetailsToolExecutionDetailsRequestEnv struct {
	Name     string                                             `json:"name,required"`
	SecretID string                                             `json:"secret_id"`
	Value    string                                             `json:"value"`
	JSON     executionDetailsToolExecutionDetailsRequestEnvJSON `json:"-"`
}

Set of key-value pairs to add to the tool's execution environment.

func (*ExecutionDetailsToolExecutionDetailsRequestEnv) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsToolExecutionDetailsRequestEnv) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsToolExecutionDetailsRequestHTTP added in v0.12.0

type ExecutionDetailsToolExecutionDetailsRequestHTTP struct {
	// List of allowed HTTP hosts and associated authentication.
	Allow []ExecutionDetailsToolExecutionDetailsRequestHTTPAllow `json:"allow"`
	JSON  executionDetailsToolExecutionDetailsRequestHTTPJSON    `json:"-"`
}

Configuration for HTTP requests and authentication.

func (*ExecutionDetailsToolExecutionDetailsRequestHTTP) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsToolExecutionDetailsRequestHTTP) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsToolExecutionDetailsRequestHTTPAllow added in v0.12.0

type ExecutionDetailsToolExecutionDetailsRequestHTTPAllow struct {
	// Authentication configuration for outbound requests to this host.
	Auth ExecutionDetailsToolExecutionDetailsRequestHTTPAllowAuth `json:"auth"`
	// The hostname to allow.
	Host string                                                   `json:"host"`
	JSON executionDetailsToolExecutionDetailsRequestHTTPAllowJSON `json:"-"`
}

List of allowed HTTP hosts and associated authentication.

func (*ExecutionDetailsToolExecutionDetailsRequestHTTPAllow) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsToolExecutionDetailsRequestHTTPAllow) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsToolExecutionDetailsRequestHTTPAllowAuth added in v0.12.0

type ExecutionDetailsToolExecutionDetailsRequestHTTPAllowAuth struct {
	Basic ExecutionDetailsToolExecutionDetailsRequestHTTPAllowAuthBasic `json:"basic"`
	// Configuration to add an 'Authorization' header using the 'Bearer' scheme.
	Bearer ExecutionDetailsToolExecutionDetailsRequestHTTPAllowAuthBearer `json:"bearer"`
	Query  ExecutionDetailsToolExecutionDetailsRequestHTTPAllowAuthQuery  `json:"query"`
	JSON   executionDetailsToolExecutionDetailsRequestHTTPAllowAuthJSON   `json:"-"`
}

Authentication configuration for outbound requests to this host.

func (*ExecutionDetailsToolExecutionDetailsRequestHTTPAllowAuth) UnmarshalJSON added in v0.12.0

type ExecutionDetailsToolExecutionDetailsRequestHTTPAllowAuthBasic added in v0.12.0

type ExecutionDetailsToolExecutionDetailsRequestHTTPAllowAuthBasic struct {
	Password string                                                            `json:"password"`
	SecretID string                                                            `json:"secret_id"`
	UserID   string                                                            `json:"user_id"`
	JSON     executionDetailsToolExecutionDetailsRequestHTTPAllowAuthBasicJSON `json:"-"`
}

func (*ExecutionDetailsToolExecutionDetailsRequestHTTPAllowAuthBasic) UnmarshalJSON added in v0.12.0

type ExecutionDetailsToolExecutionDetailsRequestHTTPAllowAuthBearer added in v0.12.0

type ExecutionDetailsToolExecutionDetailsRequestHTTPAllowAuthBearer struct {
	// The token to set, e.g. 'Authorization: Bearer <token>'.
	Token    string                                                             `json:"token"`
	SecretID string                                                             `json:"secret_id"`
	JSON     executionDetailsToolExecutionDetailsRequestHTTPAllowAuthBearerJSON `json:"-"`
}

Configuration to add an 'Authorization' header using the 'Bearer' scheme.

func (*ExecutionDetailsToolExecutionDetailsRequestHTTPAllowAuthBearer) UnmarshalJSON added in v0.12.0

type ExecutionDetailsToolExecutionDetailsRequestHTTPAllowAuthQuery added in v0.12.0

type ExecutionDetailsToolExecutionDetailsRequestHTTPAllowAuthQuery struct {
	Key      string                                                            `json:"key"`
	SecretID string                                                            `json:"secret_id"`
	Value    string                                                            `json:"value"`
	JSON     executionDetailsToolExecutionDetailsRequestHTTPAllowAuthQueryJSON `json:"-"`
}

func (*ExecutionDetailsToolExecutionDetailsRequestHTTPAllowAuthQuery) UnmarshalJSON added in v0.12.0

type ExecutionDetailsToolExecutionDetailsResponse added in v0.12.0

type ExecutionDetailsToolExecutionDetailsResponse struct {
	// The execution details of the function.
	Execution ExecutionDetailsToolExecutionDetailsResponseExecution `json:"execution,required"`
	// The returned value of the Tool's execute function.
	Output interface{} `json:"output,required"`
	// The status of the output. "valid" means your Tool executed successfully and
	// returned a valid JSON-serializable object, or void. "json_serialization_error"
	// means your Tool executed successfully, but returned a nonserializable object.
	// "error" means your Tool failed to execute.
	OutputStatus ExecutionDetailsToolExecutionDetailsResponseOutputStatus `json:"output_status,required"`
	JSON         executionDetailsToolExecutionDetailsResponseJSON         `json:"-"`
}

func (*ExecutionDetailsToolExecutionDetailsResponse) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsToolExecutionDetailsResponse) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsToolExecutionDetailsResponseExecution added in v0.12.0

type ExecutionDetailsToolExecutionDetailsResponseExecution struct {
	// The ID of the execution.
	ID string `json:"id,required"`
	// The execution time of the function in milliseconds.
	Duration int64 `json:"duration,required"`
	// The exit code returned by the function. Will often be '0' on success and
	// non-zero on failure.
	ExitCode int64 `json:"exit_code,required"`
	// The contents of 'stderr' after executing the function.
	Stderr string `json:"stderr,required"`
	// The contents of 'stdout' after executing the function.
	Stdout string                                                    `json:"stdout,required"`
	JSON   executionDetailsToolExecutionDetailsResponseExecutionJSON `json:"-"`
}

The execution details of the function.

func (*ExecutionDetailsToolExecutionDetailsResponseExecution) UnmarshalJSON added in v0.12.0

func (r *ExecutionDetailsToolExecutionDetailsResponseExecution) UnmarshalJSON(data []byte) (err error)

type ExecutionDetailsToolExecutionDetailsResponseOutputStatus added in v0.12.0

type ExecutionDetailsToolExecutionDetailsResponseOutputStatus string

The status of the output. "valid" means your Tool executed successfully and returned a valid JSON-serializable object, or void. "json_serialization_error" means your Tool executed successfully, but returned a nonserializable object. "error" means your Tool failed to execute.

const (
	ExecutionDetailsToolExecutionDetailsResponseOutputStatusError                  ExecutionDetailsToolExecutionDetailsResponseOutputStatus = "error"
	ExecutionDetailsToolExecutionDetailsResponseOutputStatusJsonSerializationError ExecutionDetailsToolExecutionDetailsResponseOutputStatus = "json_serialization_error"
	ExecutionDetailsToolExecutionDetailsResponseOutputStatusValid                  ExecutionDetailsToolExecutionDetailsResponseOutputStatus = "valid"
)

func (ExecutionDetailsToolExecutionDetailsResponseOutputStatus) IsKnown added in v0.12.0

type ExecutionDetailsToolExecutionDetailsType added in v0.12.0

type ExecutionDetailsToolExecutionDetailsType string
const (
	ExecutionDetailsToolExecutionDetailsTypeTool ExecutionDetailsToolExecutionDetailsType = "tool"
)

func (ExecutionDetailsToolExecutionDetailsType) IsKnown added in v0.12.0

type ExecutionDetailsType added in v0.12.0

type ExecutionDetailsType string
const (
	ExecutionDetailsTypeTool     ExecutionDetailsType = "tool"
	ExecutionDetailsTypeFunction ExecutionDetailsType = "function"
	ExecutionDetailsTypeScript   ExecutionDetailsType = "script"
)

func (ExecutionDetailsType) IsKnown added in v0.12.0

func (r ExecutionDetailsType) IsKnown() bool

type ExecutionDetailsUnion added in v0.12.0

type ExecutionDetailsUnion interface {
	// contains filtered or unexported methods
}

Union satisfied by ExecutionDetailsToolExecutionDetails, ExecutionDetailsFunctionExecutionDetails or ExecutionDetailsScriptExecutionDetails.

type ExecutionLanguage added in v0.12.0

type ExecutionLanguage string
const (
	ExecutionLanguagePython     ExecutionLanguage = "python"
	ExecutionLanguageJavascript ExecutionLanguage = "javascript"
	ExecutionLanguageTypescript ExecutionLanguage = "typescript"
	ExecutionLanguageRuby       ExecutionLanguage = "ruby"
	ExecutionLanguagePhp        ExecutionLanguage = "php"
)

func (ExecutionLanguage) IsKnown added in v0.12.0

func (r ExecutionLanguage) IsKnown() bool

type ExecutionListParams added in v0.12.0

type ExecutionListParams struct {
	// The number of items to return. Defaults to 100. Maximum is 100.
	Limit param.Field[int64] `query:"limit"`
	// If true, only show executions where the exit code is not 0, indicating an
	// execution error. Defaults to false.
	OnlyNonZeroExitCodes param.Field[bool] `query:"only_non_zero_exit_codes"`
	// The ID of the item to start after. To get the next page of results, set this to
	// the ID of the last item in the current page.
	StartingAfter param.Field[string] `query:"starting_after"`
}

func (ExecutionListParams) URLQuery added in v0.12.0

func (r ExecutionListParams) URLQuery() (v url.Values)

URLQuery serializes ExecutionListParams's query parameters as `url.Values`.

type ExecutionService added in v0.12.0

type ExecutionService struct {
	Options []option.RequestOption
}

ExecutionService contains methods and other services that help with interacting with the riza API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewExecutionService method instead.

func NewExecutionService added in v0.12.0

func NewExecutionService(opts ...option.RequestOption) (r *ExecutionService)

NewExecutionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ExecutionService) Get added in v0.12.0

func (r *ExecutionService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Execution, err error)

Retrieves an execution.

func (*ExecutionService) List added in v0.12.0

Returns a list of executions in your project.

func (*ExecutionService) ListAutoPaging added in v0.12.0

Returns a list of executions in your project.

type Revision added in v0.4.0

type Revision struct {
	ID                      string               `json:"id,required"`
	ManifestFile            RevisionManifestFile `json:"manifest_file,required"`
	RuntimeID               string               `json:"runtime_id,required"`
	Status                  RevisionStatus       `json:"status,required"`
	AdditionalPythonImports string               `json:"additional_python_imports"`
	JSON                    revisionJSON         `json:"-"`
}

func (*Revision) UnmarshalJSON added in v0.4.0

func (r *Revision) UnmarshalJSON(data []byte) (err error)

type RevisionManifestFile added in v0.4.0

type RevisionManifestFile struct {
	Contents string                   `json:"contents,required"`
	Name     RevisionManifestFileName `json:"name,required"`
	JSON     revisionManifestFileJSON `json:"-"`
}

func (*RevisionManifestFile) UnmarshalJSON added in v0.4.0

func (r *RevisionManifestFile) UnmarshalJSON(data []byte) (err error)

type RevisionManifestFileName added in v0.4.0

type RevisionManifestFileName string
const (
	RevisionManifestFileNameRequirementsTxt RevisionManifestFileName = "requirements.txt"
	RevisionManifestFileNamePackageJson     RevisionManifestFileName = "package.json"
)

func (RevisionManifestFileName) IsKnown added in v0.4.0

func (r RevisionManifestFileName) IsKnown() bool

type RevisionStatus added in v0.4.0

type RevisionStatus string
const (
	RevisionStatusPending   RevisionStatus = "pending"
	RevisionStatusBuilding  RevisionStatus = "building"
	RevisionStatusSucceeded RevisionStatus = "succeeded"
	RevisionStatusFailed    RevisionStatus = "failed"
	RevisionStatusCancelled RevisionStatus = "cancelled"
)

func (RevisionStatus) IsKnown added in v0.4.0

func (r RevisionStatus) IsKnown() bool

type Runtime added in v0.4.0

type Runtime struct {
	ID                      string              `json:"id,required"`
	Engine                  RuntimeEngine       `json:"engine,required"`
	Language                RuntimeLanguage     `json:"language,required"`
	Name                    string              `json:"name,required"`
	RevisionID              string              `json:"revision_id,required"`
	Status                  RuntimeStatus       `json:"status,required"`
	AdditionalPythonImports string              `json:"additional_python_imports"`
	ManifestFile            RuntimeManifestFile `json:"manifest_file"`
	JSON                    runtimeJSON         `json:"-"`
}

func (*Runtime) UnmarshalJSON added in v0.4.0

func (r *Runtime) UnmarshalJSON(data []byte) (err error)

type RuntimeDeleteResponse added in v0.12.0

type RuntimeDeleteResponse struct {
	ID      string                    `json:"id"`
	Deleted bool                      `json:"deleted"`
	JSON    runtimeDeleteResponseJSON `json:"-"`
}

func (*RuntimeDeleteResponse) UnmarshalJSON added in v0.12.0

func (r *RuntimeDeleteResponse) UnmarshalJSON(data []byte) (err error)

type RuntimeEngine added in v0.11.0

type RuntimeEngine string
const (
	RuntimeEngineWasi    RuntimeEngine = "wasi"
	RuntimeEngineMicrovm RuntimeEngine = "microvm"
	RuntimeEngineV8      RuntimeEngine = "v8"
)

func (RuntimeEngine) IsKnown added in v0.11.0

func (r RuntimeEngine) IsKnown() bool

type RuntimeLanguage added in v0.4.0

type RuntimeLanguage string
const (
	RuntimeLanguagePython     RuntimeLanguage = "python"
	RuntimeLanguageJavascript RuntimeLanguage = "javascript"
)

func (RuntimeLanguage) IsKnown added in v0.4.0

func (r RuntimeLanguage) IsKnown() bool

type RuntimeListParams added in v0.11.0

type RuntimeListParams struct {
	// The number of items to return. Defaults to 100. Maximum is 100.
	Limit param.Field[int64] `query:"limit"`
	// The ID of the item to start after. To get the next page of results, set this to
	// the ID of the last item in the current page.
	StartingAfter param.Field[string] `query:"starting_after"`
}

func (RuntimeListParams) URLQuery added in v0.11.0

func (r RuntimeListParams) URLQuery() (v url.Values)

URLQuery serializes RuntimeListParams's query parameters as `url.Values`.

type RuntimeManifestFile added in v0.4.0

type RuntimeManifestFile struct {
	Contents string                  `json:"contents,required"`
	Name     RuntimeManifestFileName `json:"name,required"`
	JSON     runtimeManifestFileJSON `json:"-"`
}

func (*RuntimeManifestFile) UnmarshalJSON added in v0.4.0

func (r *RuntimeManifestFile) UnmarshalJSON(data []byte) (err error)

type RuntimeManifestFileName added in v0.4.0

type RuntimeManifestFileName string
const (
	RuntimeManifestFileNameRequirementsTxt RuntimeManifestFileName = "requirements.txt"
	RuntimeManifestFileNamePackageJson     RuntimeManifestFileName = "package.json"
)

func (RuntimeManifestFileName) IsKnown added in v0.4.0

func (r RuntimeManifestFileName) IsKnown() bool

type RuntimeNewParams added in v0.4.0

type RuntimeNewParams struct {
	Language                param.Field[RuntimeNewParamsLanguage]     `json:"language,required"`
	ManifestFile            param.Field[RuntimeNewParamsManifestFile] `json:"manifest_file,required"`
	Name                    param.Field[string]                       `json:"name,required"`
	AdditionalPythonImports param.Field[string]                       `json:"additional_python_imports"`
	Engine                  param.Field[RuntimeNewParamsEngine]       `json:"engine"`
}

func (RuntimeNewParams) MarshalJSON added in v0.4.0

func (r RuntimeNewParams) MarshalJSON() (data []byte, err error)

type RuntimeNewParamsEngine added in v0.11.0

type RuntimeNewParamsEngine string
const (
	RuntimeNewParamsEngineWasi    RuntimeNewParamsEngine = "wasi"
	RuntimeNewParamsEngineMicrovm RuntimeNewParamsEngine = "microvm"
	RuntimeNewParamsEngineV8      RuntimeNewParamsEngine = "v8"
)

func (RuntimeNewParamsEngine) IsKnown added in v0.11.0

func (r RuntimeNewParamsEngine) IsKnown() bool

type RuntimeNewParamsLanguage added in v0.4.0

type RuntimeNewParamsLanguage string
const (
	RuntimeNewParamsLanguagePython     RuntimeNewParamsLanguage = "python"
	RuntimeNewParamsLanguageJavascript RuntimeNewParamsLanguage = "javascript"
)

func (RuntimeNewParamsLanguage) IsKnown added in v0.4.0

func (r RuntimeNewParamsLanguage) IsKnown() bool

type RuntimeNewParamsManifestFile added in v0.4.0

type RuntimeNewParamsManifestFile struct {
	Contents param.Field[string]                           `json:"contents,required"`
	Name     param.Field[RuntimeNewParamsManifestFileName] `json:"name,required"`
}

func (RuntimeNewParamsManifestFile) MarshalJSON added in v0.4.0

func (r RuntimeNewParamsManifestFile) MarshalJSON() (data []byte, err error)

type RuntimeNewParamsManifestFileName added in v0.4.0

type RuntimeNewParamsManifestFileName string
const (
	RuntimeNewParamsManifestFileNameRequirementsTxt RuntimeNewParamsManifestFileName = "requirements.txt"
	RuntimeNewParamsManifestFileNamePackageJson     RuntimeNewParamsManifestFileName = "package.json"
)

func (RuntimeNewParamsManifestFileName) IsKnown added in v0.4.0

type RuntimeRevisionListResponse added in v0.4.0

type RuntimeRevisionListResponse struct {
	Revisions []Revision                      `json:"revisions,required"`
	JSON      runtimeRevisionListResponseJSON `json:"-"`
}

func (*RuntimeRevisionListResponse) UnmarshalJSON added in v0.4.0

func (r *RuntimeRevisionListResponse) UnmarshalJSON(data []byte) (err error)

type RuntimeRevisionNewParams added in v0.4.0

type RuntimeRevisionNewParams struct {
	ManifestFile            param.Field[RuntimeRevisionNewParamsManifestFile] `json:"manifest_file,required"`
	AdditionalPythonImports param.Field[string]                               `json:"additional_python_imports"`
}

func (RuntimeRevisionNewParams) MarshalJSON added in v0.4.0

func (r RuntimeRevisionNewParams) MarshalJSON() (data []byte, err error)

type RuntimeRevisionNewParamsManifestFile added in v0.4.0

type RuntimeRevisionNewParamsManifestFile struct {
	Contents param.Field[string]                                   `json:"contents,required"`
	Name     param.Field[RuntimeRevisionNewParamsManifestFileName] `json:"name,required"`
}

func (RuntimeRevisionNewParamsManifestFile) MarshalJSON added in v0.4.0

func (r RuntimeRevisionNewParamsManifestFile) MarshalJSON() (data []byte, err error)

type RuntimeRevisionNewParamsManifestFileName added in v0.4.0

type RuntimeRevisionNewParamsManifestFileName string
const (
	RuntimeRevisionNewParamsManifestFileNameRequirementsTxt RuntimeRevisionNewParamsManifestFileName = "requirements.txt"
	RuntimeRevisionNewParamsManifestFileNamePackageJson     RuntimeRevisionNewParamsManifestFileName = "package.json"
)

func (RuntimeRevisionNewParamsManifestFileName) IsKnown added in v0.4.0

type RuntimeRevisionService added in v0.4.0

type RuntimeRevisionService struct {
	Options []option.RequestOption
}

RuntimeRevisionService contains methods and other services that help with interacting with the riza API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRuntimeRevisionService method instead.

func NewRuntimeRevisionService added in v0.4.0

func NewRuntimeRevisionService(opts ...option.RequestOption) (r *RuntimeRevisionService)

NewRuntimeRevisionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*RuntimeRevisionService) Get added in v0.4.0

func (r *RuntimeRevisionService) Get(ctx context.Context, runtimeID string, revisionID string, opts ...option.RequestOption) (res *Revision, err error)

Retrieves a runtime revision.

func (*RuntimeRevisionService) List added in v0.4.0

Lists all revisions for a runtime.

func (*RuntimeRevisionService) New added in v0.4.0

Creates a new runtime revision.

type RuntimeService added in v0.4.0

type RuntimeService struct {
	Options   []option.RequestOption
	Revisions *RuntimeRevisionService
}

RuntimeService contains methods and other services that help with interacting with the riza API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRuntimeService method instead.

func NewRuntimeService added in v0.4.0

func NewRuntimeService(opts ...option.RequestOption) (r *RuntimeService)

NewRuntimeService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*RuntimeService) Delete added in v0.12.0

func (r *RuntimeService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *RuntimeDeleteResponse, err error)

Deletes a runtime.

func (*RuntimeService) Get added in v0.4.0

func (r *RuntimeService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Runtime, err error)

Retrieves a runtime.

func (*RuntimeService) List added in v0.4.0

Returns a list of runtimes in your project.

func (*RuntimeService) ListAutoPaging added in v0.11.0

Returns a list of runtimes in your project.

func (*RuntimeService) New added in v0.4.0

func (r *RuntimeService) New(ctx context.Context, body RuntimeNewParams, opts ...option.RequestOption) (res *Runtime, err error)

Creates a runtime.

type RuntimeStatus added in v0.10.0

type RuntimeStatus string
const (
	RuntimeStatusPending   RuntimeStatus = "pending"
	RuntimeStatusBuilding  RuntimeStatus = "building"
	RuntimeStatusSucceeded RuntimeStatus = "succeeded"
	RuntimeStatusFailed    RuntimeStatus = "failed"
	RuntimeStatusCancelled RuntimeStatus = "cancelled"
)

func (RuntimeStatus) IsKnown added in v0.10.0

func (r RuntimeStatus) IsKnown() bool

type Secret

type Secret struct {
	ID   string     `json:"id,required"`
	Name string     `json:"name,required"`
	JSON secretJSON `json:"-"`
}

func (*Secret) UnmarshalJSON

func (r *Secret) UnmarshalJSON(data []byte) (err error)

type SecretListParams added in v0.11.0

type SecretListParams struct {
	// The number of items to return. Defaults to 100. Maximum is 100.
	Limit param.Field[int64] `query:"limit"`
	// The ID of the item to start after. To get the next page of results, set this to
	// the ID of the last item in the current page.
	StartingAfter param.Field[string] `query:"starting_after"`
}

func (SecretListParams) URLQuery added in v0.11.0

func (r SecretListParams) URLQuery() (v url.Values)

URLQuery serializes SecretListParams's query parameters as `url.Values`.

type SecretNewParams added in v0.2.0

type SecretNewParams struct {
	Name  param.Field[string] `json:"name,required"`
	Value param.Field[string] `json:"value,required"`
}

func (SecretNewParams) MarshalJSON added in v0.2.0

func (r SecretNewParams) MarshalJSON() (data []byte, err error)

type SecretService

type SecretService struct {
	Options []option.RequestOption
}

SecretService contains methods and other services that help with interacting with the riza API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSecretService method instead.

func NewSecretService

func NewSecretService(opts ...option.RequestOption) (r *SecretService)

NewSecretService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SecretService) List

Returns a list of secrets in your project.

func (*SecretService) ListAutoPaging added in v0.11.0

Returns a list of secrets in your project.

func (*SecretService) New added in v0.2.0

func (r *SecretService) New(ctx context.Context, body SecretNewParams, opts ...option.RequestOption) (res *Secret, err error)

Create a secret in your project.

type Tool

type Tool struct {
	// The ID of the tool.
	ID string `json:"id,required"`
	// The code of the tool. You must define a function named "execute" that takes in a
	// single argument and returns a JSON-serializable value. The argument will be the
	// "input" passed when executing the tool, and will match the input schema.
	Code string `json:"code,required"`
	// A description of the tool.
	Description string `json:"description,required"`
	// The input schema of the tool. This must be a valid JSON Schema object.
	InputSchema interface{} `json:"input_schema,required"`
	// The language of the tool's code.
	Language ToolLanguage `json:"language,required"`
	// The name of the tool.
	Name string `json:"name,required"`
	// The ID of the tool's current revision. This is used to pin executions to a
	// specific version of the tool, even if the tool is updated later.
	RevisionID string `json:"revision_id,required"`
	// The ID of the custom runtime revision that the tool uses for executions. This
	// pins executions to specific version of a custom runtime runtime, even if the
	// runtime is updated later.
	RuntimeRevisionID string   `json:"runtime_revision_id"`
	JSON              toolJSON `json:"-"`
}

func (*Tool) UnmarshalJSON

func (r *Tool) UnmarshalJSON(data []byte) (err error)

type ToolExecParams

type ToolExecParams struct {
	// Set of key-value pairs to add to the tool's execution environment.
	Env param.Field[[]ToolExecParamsEnv] `json:"env"`
	// Configuration for HTTP requests and authentication.
	HTTP param.Field[ToolExecParamsHTTP] `json:"http"`
	// The input to the tool. This must be a valid JSON-serializable object. It will be
	// validated against the tool's input schema.
	Input param.Field[interface{}] `json:"input"`
	// The Tool revision ID to execute. This optional parmeter is used to pin
	// executions to specific versions of the Tool. If not provided, the latest
	// (current) version of the Tool will be executed.
	RevisionID param.Field[string] `json:"revision_id"`
}

func (ToolExecParams) MarshalJSON

func (r ToolExecParams) MarshalJSON() (data []byte, err error)

type ToolExecParamsEnv

type ToolExecParamsEnv struct {
	Name     param.Field[string] `json:"name,required"`
	SecretID param.Field[string] `json:"secret_id"`
	Value    param.Field[string] `json:"value"`
}

Set of key-value pairs to add to the tool's execution environment.

func (ToolExecParamsEnv) MarshalJSON

func (r ToolExecParamsEnv) MarshalJSON() (data []byte, err error)

type ToolExecParamsHTTP

type ToolExecParamsHTTP struct {
	// List of allowed HTTP hosts and associated authentication.
	Allow param.Field[[]ToolExecParamsHTTPAllow] `json:"allow"`
}

Configuration for HTTP requests and authentication.

func (ToolExecParamsHTTP) MarshalJSON

func (r ToolExecParamsHTTP) MarshalJSON() (data []byte, err error)

type ToolExecParamsHTTPAllow

type ToolExecParamsHTTPAllow struct {
	// Authentication configuration for outbound requests to this host.
	Auth param.Field[ToolExecParamsHTTPAllowAuth] `json:"auth"`
	// The hostname to allow.
	Host param.Field[string] `json:"host"`
}

List of allowed HTTP hosts and associated authentication.

func (ToolExecParamsHTTPAllow) MarshalJSON

func (r ToolExecParamsHTTPAllow) MarshalJSON() (data []byte, err error)

type ToolExecParamsHTTPAllowAuth

type ToolExecParamsHTTPAllowAuth struct {
	Basic param.Field[ToolExecParamsHTTPAllowAuthBasic] `json:"basic"`
	// Configuration to add an 'Authorization' header using the 'Bearer' scheme.
	Bearer param.Field[ToolExecParamsHTTPAllowAuthBearer] `json:"bearer"`
	Query  param.Field[ToolExecParamsHTTPAllowAuthQuery]  `json:"query"`
}

Authentication configuration for outbound requests to this host.

func (ToolExecParamsHTTPAllowAuth) MarshalJSON

func (r ToolExecParamsHTTPAllowAuth) MarshalJSON() (data []byte, err error)

type ToolExecParamsHTTPAllowAuthBasic

type ToolExecParamsHTTPAllowAuthBasic struct {
	Password param.Field[string] `json:"password"`
	SecretID param.Field[string] `json:"secret_id"`
	UserID   param.Field[string] `json:"user_id"`
}

func (ToolExecParamsHTTPAllowAuthBasic) MarshalJSON

func (r ToolExecParamsHTTPAllowAuthBasic) MarshalJSON() (data []byte, err error)

type ToolExecParamsHTTPAllowAuthBearer

type ToolExecParamsHTTPAllowAuthBearer struct {
	// The token to set, e.g. 'Authorization: Bearer <token>'.
	Token    param.Field[string] `json:"token"`
	SecretID param.Field[string] `json:"secret_id"`
}

Configuration to add an 'Authorization' header using the 'Bearer' scheme.

func (ToolExecParamsHTTPAllowAuthBearer) MarshalJSON

func (r ToolExecParamsHTTPAllowAuthBearer) MarshalJSON() (data []byte, err error)

type ToolExecParamsHTTPAllowAuthQuery

type ToolExecParamsHTTPAllowAuthQuery struct {
	Key      param.Field[string] `json:"key"`
	SecretID param.Field[string] `json:"secret_id"`
	Value    param.Field[string] `json:"value"`
}

func (ToolExecParamsHTTPAllowAuthQuery) MarshalJSON

func (r ToolExecParamsHTTPAllowAuthQuery) MarshalJSON() (data []byte, err error)

type ToolExecResponse

type ToolExecResponse struct {
	// The execution details of the function.
	Execution ToolExecResponseExecution `json:"execution,required"`
	// The returned value of the Tool's execute function.
	Output interface{} `json:"output,required"`
	// The status of the output. "valid" means your Tool executed successfully and
	// returned a valid JSON-serializable object, or void. "json_serialization_error"
	// means your Tool executed successfully, but returned a nonserializable object.
	// "error" means your Tool failed to execute.
	OutputStatus ToolExecResponseOutputStatus `json:"output_status,required"`
	JSON         toolExecResponseJSON         `json:"-"`
}

func (*ToolExecResponse) UnmarshalJSON

func (r *ToolExecResponse) UnmarshalJSON(data []byte) (err error)

type ToolExecResponseExecution

type ToolExecResponseExecution struct {
	// The ID of the execution.
	ID string `json:"id,required"`
	// The execution time of the function in milliseconds.
	Duration int64 `json:"duration,required"`
	// The exit code returned by the function. Will often be '0' on success and
	// non-zero on failure.
	ExitCode int64 `json:"exit_code,required"`
	// The contents of 'stderr' after executing the function.
	Stderr string `json:"stderr,required"`
	// The contents of 'stdout' after executing the function.
	Stdout string                        `json:"stdout,required"`
	JSON   toolExecResponseExecutionJSON `json:"-"`
}

The execution details of the function.

func (*ToolExecResponseExecution) UnmarshalJSON

func (r *ToolExecResponseExecution) UnmarshalJSON(data []byte) (err error)

type ToolExecResponseOutputStatus added in v0.8.0

type ToolExecResponseOutputStatus string

The status of the output. "valid" means your Tool executed successfully and returned a valid JSON-serializable object, or void. "json_serialization_error" means your Tool executed successfully, but returned a nonserializable object. "error" means your Tool failed to execute.

const (
	ToolExecResponseOutputStatusError                  ToolExecResponseOutputStatus = "error"
	ToolExecResponseOutputStatusJsonSerializationError ToolExecResponseOutputStatus = "json_serialization_error"
	ToolExecResponseOutputStatusValid                  ToolExecResponseOutputStatus = "valid"
)

func (ToolExecResponseOutputStatus) IsKnown added in v0.8.0

func (r ToolExecResponseOutputStatus) IsKnown() bool

type ToolLanguage

type ToolLanguage string

The language of the tool's code.

const (
	ToolLanguagePython     ToolLanguage = "python"
	ToolLanguageJavascript ToolLanguage = "javascript"
	ToolLanguageTypescript ToolLanguage = "typescript"
)

func (ToolLanguage) IsKnown

func (r ToolLanguage) IsKnown() bool

type ToolListParams added in v0.11.0

type ToolListParams struct {
	// The number of items to return. Defaults to 100. Maximum is 100.
	Limit param.Field[int64] `query:"limit"`
	// The ID of the item to start after. To get the next page of results, set this to
	// the ID of the last item in the current page.
	StartingAfter param.Field[string] `query:"starting_after"`
}

func (ToolListParams) URLQuery added in v0.11.0

func (r ToolListParams) URLQuery() (v url.Values)

URLQuery serializes ToolListParams's query parameters as `url.Values`.

type ToolNewParams

type ToolNewParams struct {
	// The code of the tool. You must define a function named "execute" that takes in a
	// single argument and returns a JSON-serializable value. The argument will be the
	// "input" passed when executing the tool, and will match the input schema.
	Code param.Field[string] `json:"code,required"`
	// The language of the tool's code.
	Language param.Field[ToolNewParamsLanguage] `json:"language,required"`
	// The name of the tool.
	Name param.Field[string] `json:"name,required"`
	// A description of the tool.
	Description param.Field[string] `json:"description"`
	// The input schema of the tool. This must be a valid JSON Schema object.
	InputSchema param.Field[interface{}] `json:"input_schema"`
	// The ID of the runtime revision to use when executing the tool.
	RuntimeRevisionID param.Field[string] `json:"runtime_revision_id"`
}

func (ToolNewParams) MarshalJSON

func (r ToolNewParams) MarshalJSON() (data []byte, err error)

type ToolNewParamsLanguage

type ToolNewParamsLanguage string

The language of the tool's code.

const (
	ToolNewParamsLanguagePython     ToolNewParamsLanguage = "python"
	ToolNewParamsLanguageJavascript ToolNewParamsLanguage = "javascript"
	ToolNewParamsLanguageTypescript ToolNewParamsLanguage = "typescript"
)

func (ToolNewParamsLanguage) IsKnown

func (r ToolNewParamsLanguage) IsKnown() bool

type ToolService

type ToolService struct {
	Options []option.RequestOption
}

ToolService contains methods and other services that help with interacting with the riza API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewToolService method instead.

func NewToolService

func NewToolService(opts ...option.RequestOption) (r *ToolService)

NewToolService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ToolService) Exec

func (r *ToolService) Exec(ctx context.Context, id string, body ToolExecParams, opts ...option.RequestOption) (res *ToolExecResponse, err error)

Execute a tool with a given input. The input is validated against the tool's input schema.

func (*ToolService) Get

func (r *ToolService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Tool, err error)

Retrieves a tool.

func (*ToolService) List

Returns a list of tools in your project.

func (*ToolService) ListAutoPaging added in v0.11.0

Returns a list of tools in your project.

func (*ToolService) New

func (r *ToolService) New(ctx context.Context, body ToolNewParams, opts ...option.RequestOption) (res *Tool, err error)

Create a tool in your project.

func (*ToolService) Update

func (r *ToolService) Update(ctx context.Context, id string, body ToolUpdateParams, opts ...option.RequestOption) (res *Tool, err error)

Update the source code and input schema of a tool.

type ToolUpdateParams

type ToolUpdateParams struct {
	// The code of the tool. You must define a function named "execute" that takes in a
	// single argument and returns a JSON-serializable value. The argument will be the
	// "input" passed when executing the tool, and will match the input schema.
	Code param.Field[string] `json:"code"`
	// A description of the tool.
	Description param.Field[string] `json:"description"`
	// The input schema of the tool. This must be a valid JSON Schema object.
	InputSchema param.Field[interface{}] `json:"input_schema"`
	// The language of the tool's code.
	Language param.Field[ToolUpdateParamsLanguage] `json:"language"`
	// The name of the tool.
	Name param.Field[string] `json:"name"`
	// The ID of the custom runtime revision that the tool uses for executions. This is
	// used to pin executions to a specific version of a custom runtime, even if the
	// runtime is updated later.
	RuntimeRevisionID param.Field[string] `json:"runtime_revision_id"`
}

func (ToolUpdateParams) MarshalJSON

func (r ToolUpdateParams) MarshalJSON() (data []byte, err error)

type ToolUpdateParamsLanguage

type ToolUpdateParamsLanguage string

The language of the tool's code.

const (
	ToolUpdateParamsLanguagePython     ToolUpdateParamsLanguage = "python"
	ToolUpdateParamsLanguageJavascript ToolUpdateParamsLanguage = "javascript"
	ToolUpdateParamsLanguageTypescript ToolUpdateParamsLanguage = "typescript"
)

func (ToolUpdateParamsLanguage) IsKnown

func (r ToolUpdateParamsLanguage) IsKnown() bool

Directories

Path Synopsis
packages

Jump to

Keyboard shortcuts

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