Documentation ¶
Index ¶
- func NewRunnable(environment, userId, namespace, fnName, language string) *directive.Runnable
- func NewRunnableVersion(environment, userId, namespace, fnName, version, language string) *directive.Runnable
- type BuildResult
- type Client
- func (c *Client) BuildFunction(runnable *directive.Runnable, functionBody io.Reader) (*BuildResult, error)
- func (c *Client) BuildFunctionString(runnable *directive.Runnable, functionString string) (*BuildResult, error)
- func (c *Client) BuilderFeatures() (*FeaturesResponse, error)
- func (c *Client) BuilderHealth() (bool, error)
- func (c *Client) BuilderTemplate(runnable *directive.Runnable) (*EditorStateResponse, error)
- func (c *Client) EditorToken(runnable *directive.Runnable) (string, error)
- func (c *Client) Exec(runnable *directive.Runnable, body io.Reader) ([]byte, string, error)
- func (c *Client) ExecString(runnable *directive.Runnable, body string) ([]byte, string, error)
- func (c *Client) FunctionResult(uuid string) ([]byte, error)
- func (c *Client) FunctionResultMetadata(uuid string) (*ExecMetadata, error)
- func (c *Client) FunctionResultsMetadata(runnable *directive.Runnable) ([]ExecMetadata, error)
- func (c *Client) GetDraft(runnable *directive.Runnable) (*EditorStateResponse, error)
- func (c *Client) PromoteDraft(runnable *directive.Runnable) (*PromoteDraftResponse, error)
- func (c *Client) UserFunctions(identifier string, namespace string) ([]*directive.Runnable, error)
- type Config
- type EditorStateResponse
- type ExecError
- type ExecMetadata
- type ExecResponse
- type FeatureLanguage
- type FeaturesResponse
- type PromoteDraftResponse
- type TestPayload
- type TokenResponse
- type UserFunctionsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRunnable ¶
NewRunnable instantiates a local v1.0.0 Runnable that can be used for various calls with compute.Client. Note: this constructor alone does not perform any actions on a remote Compute instance.
func NewRunnableVersion ¶
func NewRunnableVersion(environment, userId, namespace, fnName, version, language string) *directive.Runnable
NewRunnableVersion instantiates a local versioned Runnable that can be used for various calls with compute.Client. Note: this constructor alone does not perform any actions on a remote Compute instance.
Types ¶
type BuildResult ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is used for interacting with the Suborbital Compute API
func NewLocalClient ¶
NewLocalClient quickly sets up a Client with a LocalConfig. Useful for testing.
func (*Client) BuildFunction ¶
func (c *Client) BuildFunction(runnable *directive.Runnable, functionBody io.Reader) (*BuildResult, error)
BuildFunction triggers a remote build for the given Runnable and function body. See also: Client.BuildFunctionString()
Example ¶
This function is useful for reading from a filesystem or from an http.Response.Body
runnable := compute.NewRunnable("com.suborbital", "acmeco", "default", "hello", "rust") file, _ := os.Open("hello.rs") result, err := client.BuildFunction(runnable, file)
func (*Client) BuildFunctionString ¶
func (c *Client) BuildFunctionString(runnable *directive.Runnable, functionString string) (*BuildResult, error)
BuildFunctionString triggers a remote build for the given Runnable and function string. See also: Client.BuildFunction()
func (*Client) BuilderFeatures ¶
func (c *Client) BuilderFeatures() (*FeaturesResponse, error)
BuilderFeatures lists the features present on the builder, such as testing capabilities.
func (*Client) BuilderHealth ¶
BuilderHealth is used to check that the builder is healthy and responding to requests.
func (*Client) BuilderTemplate ¶
func (c *Client) BuilderTemplate(runnable *directive.Runnable) (*EditorStateResponse, error)
BuilderTemplate gets the function template for the provided Runnable. The Runnable must have the .Lang, .Name, and .Namespace fields set.
func (*Client) EditorToken ¶
EditorToken gets an editor token for the provided Runnable. Note: this library manages editor tokens for you, so you most likely do not need to use this function.
func (*Client) Exec ¶
Exec remotely executes the provided runnable using the body as input. See also: ExecString()
func (*Client) ExecString ¶
ExecString sets up a buffer with the provided string and calls Exec
func (*Client) FunctionResult ¶ added in v0.1.0
FunctionResult returns the result of the provided runnable execution.
func (*Client) FunctionResultMetadata ¶ added in v0.1.0
func (c *Client) FunctionResultMetadata(uuid string) (*ExecMetadata, error)
FunctionResultMetadata returns metadata for the provided runnable execution.
func (*Client) FunctionResultsMetadata ¶ added in v0.1.0
func (c *Client) FunctionResultsMetadata(runnable *directive.Runnable) ([]ExecMetadata, error)
FunctionResultsMetadata returns metadata for the 5 most recent execution results for the provided runnable.
func (*Client) GetDraft ¶
func (c *Client) GetDraft(runnable *directive.Runnable) (*EditorStateResponse, error)
GetDraft gets the most recently build source code for the provided Runnable. Must have the .FQFNURI field set.
func (*Client) PromoteDraft ¶
func (c *Client) PromoteDraft(runnable *directive.Runnable) (*PromoteDraftResponse, error)
PromoteDraft takes the most recent build of the provided runnable and deploys it so it can be run. The .Version field of the provided runnable is modified in place if the promotion is successful.
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config combines the common configuration options for the three Suborbital Compute APIs (Administrative, Builder, and Execution)
func CustomConfig ¶ added in v0.1.2
Custom Configuration
func DefaultConfig ¶
DefaultConfig takes the given host and creates a Compute config with the K8S default ports. Everything except the scheme and hostname are considered. You need to provide your builder host domain.
func LocalConfig ¶
func LocalConfig() *Config
LocalConfig generates a Configuration for Compute running in docker-compose
type EditorStateResponse ¶
type EditorStateResponse struct { Lang string `json:"lang"` Contents string `json:"contents"` Tests []TestPayload `json:"tests"` }
EditorStateResponse is a response to requests to get editorState
type ExecMetadata ¶ added in v0.1.0
type ExecResponse ¶ added in v0.1.0
type FeatureLanguage ¶ added in v0.1.1
type FeaturesResponse ¶
type FeaturesResponse struct { Features []string `json:"features"` Langauges []FeatureLanguage `json:"languages"` }
type PromoteDraftResponse ¶
type PromoteDraftResponse struct {
Version string `json:"version"`
}
type TestPayload ¶
type TestPayload struct { Name string `json:"name"` Description string `json:"description"` Payload string `json:"payload"` }
TestPayload is a single test for a Runnable
type TokenResponse ¶
type TokenResponse struct {
Token string `json:"token"`
}