Documentation
¶
Index ¶
- func Bool(b bool) param.Opt[bool]
- func BoolPtr(v bool) *bool
- func DefaultClientOptions() []option.RequestOption
- func File(rdr io.Reader, filename string, contentType string) file
- func Float(f float64) param.Opt[float64]
- func FloatPtr(v float64) *float64
- func Int(i int64) param.Opt[int64]
- func IntPtr(v int64) *int64
- func Opt[T comparable](v T) param.Opt[T]
- func Ptr[T any](v T) *T
- func String(s string) param.Opt[string]
- func StringPtr(v string) *string
- func Time(t time.Time) param.Opt[time.Time]
- func TimePtr(v time.Time) *time.Time
- type AppDeployParams
- type AppDeployParamsForce
- type AppDeployParamsRegion
- type AppDeployResponse
- type AppDeployResponseApp
- type AppDeployResponseAppAction
- type AppGetInvocationResponse
- type AppInvokeParams
- type AppInvokeResponse
- type AppInvokeResponseStatus
- type AppService
- func (r *AppService) Deploy(ctx context.Context, body AppDeployParams, opts ...option.RequestOption) (res *AppDeployResponse, err error)
- func (r *AppService) GetInvocation(ctx context.Context, id string, opts ...option.RequestOption) (res *AppGetInvocationResponse, err error)
- func (r *AppService) Invoke(ctx context.Context, body AppInvokeParams, opts ...option.RequestOption) (res *AppInvokeResponse, err error)
- type BrowserNewSessionParams
- type BrowserNewSessionResponse
- type BrowserService
- type Client
- func (r *Client) Delete(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, ...) error
- func (r *Client) Get(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Patch(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Post(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Put(ctx context.Context, path string, params any, res any, ...) error
- type Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (KERNEL_API_KEY, KERNEL_BASE_URL). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type AppDeployParams ¶
type AppDeployParams struct { // Relative path to the entrypoint of the application EntrypointRelPath string `json:"entrypointRelPath,required"` // ZIP file containing the application source directory File io.Reader `json:"file,omitzero,required" format:"binary"` // Version of the application. Can be any string. Version param.Opt[string] `json:"version,omitzero"` // Allow overwriting an existing app version // // Any of "true", "false". Force AppDeployParamsForce `json:"force,omitzero"` // Region for deployment. Currently we only support "aws.us-east-1a" // // Any of "aws.us-east-1a". Region AppDeployParamsRegion `json:"region,omitzero"` // contains filtered or unexported fields }
func (AppDeployParams) MarshalMultipart ¶
func (r AppDeployParams) MarshalMultipart() (data []byte, contentType string, err error)
type AppDeployParamsForce ¶
type AppDeployParamsForce string
Allow overwriting an existing app version
const ( AppDeployParamsForceTrue AppDeployParamsForce = "true" AppDeployParamsForceFalse AppDeployParamsForce = "false" )
type AppDeployParamsRegion ¶
type AppDeployParamsRegion string
Region for deployment. Currently we only support "aws.us-east-1a"
const (
AppDeployParamsRegionAwsUsEast1a AppDeployParamsRegion = "aws.us-east-1a"
)
type AppDeployResponse ¶
type AppDeployResponse struct { Apps []AppDeployResponseApp `json:"apps,required"` // Success message Message string `json:"message,required"` // Status of the deployment Success bool `json:"success,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Apps respjson.Field Message respjson.Field Success respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (AppDeployResponse) RawJSON ¶
func (r AppDeployResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AppDeployResponse) UnmarshalJSON ¶
func (r *AppDeployResponse) UnmarshalJSON(data []byte) error
type AppDeployResponseApp ¶
type AppDeployResponseApp struct { // ID for the app version deployed ID string `json:"id,required"` Actions []AppDeployResponseAppAction `json:"actions,required"` // Name of the app Name string `json:"name,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field Actions respjson.Field Name respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (AppDeployResponseApp) RawJSON ¶
func (r AppDeployResponseApp) RawJSON() string
Returns the unmodified JSON received from the API
func (*AppDeployResponseApp) UnmarshalJSON ¶
func (r *AppDeployResponseApp) UnmarshalJSON(data []byte) error
type AppDeployResponseAppAction ¶
type AppDeployResponseAppAction struct { // Name of the action Name string `json:"name,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Name respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (AppDeployResponseAppAction) RawJSON ¶
func (r AppDeployResponseAppAction) RawJSON() string
Returns the unmodified JSON received from the API
func (*AppDeployResponseAppAction) UnmarshalJSON ¶
func (r *AppDeployResponseAppAction) UnmarshalJSON(data []byte) error
type AppGetInvocationResponse ¶
type AppGetInvocationResponse struct { ID string `json:"id,required"` AppName string `json:"appName,required"` FinishedAt string `json:"finishedAt,required"` Input string `json:"input,required"` Output string `json:"output,required"` StartedAt string `json:"startedAt,required"` Status string `json:"status,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field AppName respjson.Field FinishedAt respjson.Field Input respjson.Field Output respjson.Field StartedAt respjson.Field Status respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (AppGetInvocationResponse) RawJSON ¶
func (r AppGetInvocationResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AppGetInvocationResponse) UnmarshalJSON ¶
func (r *AppGetInvocationResponse) UnmarshalJSON(data []byte) error
type AppInvokeParams ¶
type AppInvokeParams struct { // Name of the action to invoke ActionName string `json:"actionName,required"` // Name of the application AppName string `json:"appName,required"` // Input data for the application Payload any `json:"payload,omitzero,required"` // Version of the application Version string `json:"version,required"` // contains filtered or unexported fields }
func (AppInvokeParams) MarshalJSON ¶
func (r AppInvokeParams) MarshalJSON() (data []byte, err error)
func (*AppInvokeParams) UnmarshalJSON ¶
func (r *AppInvokeParams) UnmarshalJSON(data []byte) error
type AppInvokeResponse ¶
type AppInvokeResponse struct { // ID of the invocation ID string `json:"id,required"` // Status of the invocation // // Any of "QUEUED", "RUNNING", "SUCCEEDED", "FAILED". Status AppInvokeResponseStatus `json:"status,required"` // Output from the invocation (if available) Output string `json:"output"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field Status respjson.Field Output respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (AppInvokeResponse) RawJSON ¶
func (r AppInvokeResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AppInvokeResponse) UnmarshalJSON ¶
func (r *AppInvokeResponse) UnmarshalJSON(data []byte) error
type AppInvokeResponseStatus ¶
type AppInvokeResponseStatus string
Status of the invocation
const ( AppInvokeResponseStatusQueued AppInvokeResponseStatus = "QUEUED" AppInvokeResponseStatusRunning AppInvokeResponseStatus = "RUNNING" AppInvokeResponseStatusSucceeded AppInvokeResponseStatus = "SUCCEEDED" AppInvokeResponseStatusFailed AppInvokeResponseStatus = "FAILED" )
type AppService ¶
type AppService struct {
Options []option.RequestOption
}
AppService contains methods and other services that help with interacting with the kernel 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 NewAppService method instead.
func NewAppService ¶
func NewAppService(opts ...option.RequestOption) (r AppService)
NewAppService 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 (*AppService) Deploy ¶
func (r *AppService) Deploy(ctx context.Context, body AppDeployParams, opts ...option.RequestOption) (res *AppDeployResponse, err error)
Deploy a new application
func (*AppService) GetInvocation ¶
func (r *AppService) GetInvocation(ctx context.Context, id string, opts ...option.RequestOption) (res *AppGetInvocationResponse, err error)
Get an app invocation by id
func (*AppService) Invoke ¶
func (r *AppService) Invoke(ctx context.Context, body AppInvokeParams, opts ...option.RequestOption) (res *AppInvokeResponse, err error)
Invoke an application
type BrowserNewSessionParams ¶
type BrowserNewSessionParams struct { // Kernel App invocation ID InvocationID string `json:"invocationId,required"` // contains filtered or unexported fields }
func (BrowserNewSessionParams) MarshalJSON ¶
func (r BrowserNewSessionParams) MarshalJSON() (data []byte, err error)
func (*BrowserNewSessionParams) UnmarshalJSON ¶
func (r *BrowserNewSessionParams) UnmarshalJSON(data []byte) error
type BrowserNewSessionResponse ¶
type BrowserNewSessionResponse struct { // Websocket URL for Chrome DevTools Protocol connections to the browser session CdpWsURL string `json:"cdp_ws_url,required"` // Remote URL for live viewing the browser session RemoteURL string `json:"remote_url,required"` // Unique identifier for the browser session SessionID string `json:"sessionId,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { CdpWsURL respjson.Field RemoteURL respjson.Field SessionID respjson.Field ExtraFields map[string]respjson.Field // contains filtered or unexported fields } `json:"-"` }
func (BrowserNewSessionResponse) RawJSON ¶
func (r BrowserNewSessionResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrowserNewSessionResponse) UnmarshalJSON ¶
func (r *BrowserNewSessionResponse) UnmarshalJSON(data []byte) error
type BrowserService ¶
type BrowserService struct {
Options []option.RequestOption
}
BrowserService contains methods and other services that help with interacting with the kernel 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 NewBrowserService method instead.
func NewBrowserService ¶
func NewBrowserService(opts ...option.RequestOption) (r BrowserService)
NewBrowserService 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 (*BrowserService) NewSession ¶
func (r *BrowserService) NewSession(ctx context.Context, body BrowserNewSessionParams, opts ...option.RequestOption) (res *BrowserNewSessionResponse, err error)
Create Browser Session
type Client ¶
type Client struct { Options []option.RequestOption Apps AppService Browser BrowserService }
Client creates a struct with services and top level methods that help with interacting with the kernel 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 (KERNEL_API_KEY, KERNEL_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 any, res any, 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 any, res any, 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 any, res any, 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 any, res any, 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.
Directories
¶
Path | Synopsis |
---|---|
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
|
Package json implements encoding and decoding of JSON as defined in RFC 7159. |
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.21, and used by the Go 1.24 encoding/json package.
|
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.21, and used by the Go 1.24 encoding/json package. |
packages
|
|
shared
|
|