Documentation
¶
Index ¶
- Constants
- func FormatActionID(appID, actionName string) string
- func ParseActionID(id string) (appID, actionName string, err error)
- type App
- type AppAction
- type AppFunction
- type AppList
- type DeferredExecutionRequest
- type DeferredExecutionResponse
- type ExecutionError
- type FunctionExecutorRequest
- type FunctionExecutorResponse
- type FunctionHandler
- func (h *FunctionHandler) DeferExecution(ctx context.Context, req *DeferredExecutionRequest) (*DeferredExecutionResponse, error)
- func (h *FunctionHandler) ExecuteCode(ctx context.Context, sourceCode, payload string) (*FunctionExecutorResponse, error)
- func (h *FunctionHandler) ExecuteRequest(ctx context.Context, req *FunctionExecutorRequest) (*FunctionExecutorResponse, error)
- func (h *FunctionHandler) GetSDKVersions(ctx context.Context) (*SDKVersionsResponse, error)
- func (h *FunctionHandler) InvokeFunction(ctx context.Context, req *FunctionInvokeRequest) (*FunctionInvokeResponse, error)
- type FunctionInvokeRequest
- type FunctionInvokeResponse
- type Handler
- func (h *Handler) DeleteApp(ctx context.Context, appID string) error
- func (h *Handler) GetAction(ctx context.Context, fullName string) (*AppAction, error)
- func (h *Handler) GetApp(ctx context.Context, appID string) (*App, error)
- func (h *Handler) GetFunction(ctx context.Context, fullName string) (*AppFunction, error)
- func (h *Handler) ListActions(ctx context.Context, opts ListActionsOptions) ([]AppAction, error)
- func (h *Handler) ListApps(ctx context.Context) (*AppList, error)
- func (h *Handler) ListFunctions(ctx context.Context, appIDFilter string) ([]AppFunction, error)
- type ListActionsOptions
- type ModificationInfo
- type ResourceStatus
- type SDKVersionsResponse
- type SignatureInfo
Constants ¶
const MaxActionFilterLength = 256
MaxActionFilterLength is the longest filter expression the endpoint accepts.
const MaxActionQueryLength = 256
MaxActionQueryLength is the longest search string the endpoint accepts.
Variables ¶
This section is empty.
Functions ¶
func FormatActionID ¶
FormatActionID is the inverse of ParseActionID, in the canonical colon form.
func ParseActionID ¶
ParseActionID splits an action id of the form "app-id:action-name", the form workflow definitions use. "app-id/action-name", the form function ids use, is accepted too but never advertised: error messages and FormatActionID always spell the colon. It splits at the first colon or slash, whichever comes first: an app id can contain neither, an action name can contain both.
Types ¶
type App ¶
type App struct {
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
IsBuiltin bool `json:"isBuiltin,omitempty"`
ResourceStatus *ResourceStatus `json:"resourceStatus,omitempty"`
SignatureInfo *SignatureInfo `json:"signatureInfo,omitempty"`
Manifest map[string]interface{} `json:"manifest,omitempty"`
ModificationInfo *ModificationInfo `json:"modificationInfo,omitempty"`
}
App represents an installed app
type AppAction ¶
type AppAction struct {
AppID string `json:"appId"`
ActionName string `json:"actionName"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Stateful bool `json:"stateful,omitempty"`
Approval bool `json:"approval,omitempty"`
FullName string `json:"fullName"`
// Extra holds the action's manifest attributes with no field above, such
// as docs. Populated by GetAction only: GET /actions serves a fixed field
// set, so ListActions never has them.
Extra map[string]interface{} `json:"extra,omitempty"`
}
AppAction is one action of an installed app, as the App Registry's /actions API serves it.
type AppFunction ¶
type AppFunction struct {
AppID string `json:"appId"`
AppName string `json:"appName"`
FunctionName string `json:"functionName"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Resumable bool `json:"resumable"`
Stateful bool `json:"stateful,omitempty"`
FullName string `json:"fullName"`
}
AppFunction represents a function within an app
type DeferredExecutionRequest ¶
type DeferredExecutionRequest struct {
AppID string `json:"appId"`
FunctionName string `json:"functionName"`
Body string `json:"body,omitempty"`
}
DeferredExecutionRequest represents a deferred execution request
type DeferredExecutionResponse ¶
type DeferredExecutionResponse struct {
ID string `json:"id"`
}
DeferredExecutionResponse represents a deferred execution response
type ExecutionError ¶
type ExecutionError struct {
// StatusCode is the non-standard status App Engine used to report the failure.
StatusCode int
// Message is the platform's description of the failure.
Message string
// Body is the raw response body, which holds the stack trace when there is one.
Body string
}
ExecutionError reports a failure inside the submitted function code.
It is deliberately not an httpclient.APIError. The request reached App Engine and App Engine answered; what failed is the caller's own code. Carrying it as a 5xx would classify a deterministic bug as a Dynatrace-side outage, which tells an agent to retry something that can never succeed unchanged.
func (*ExecutionError) Error ¶
func (e *ExecutionError) Error() string
type FunctionExecutorRequest ¶
type FunctionExecutorRequest struct {
SourceCode string `json:"sourceCode"`
Payload string `json:"payload,omitempty"`
// SDKMajorVersions pins SDK packages (package name → major version) for the
// execution. omitzero, not omitempty: a nil map leaves the field out of the
// request, while a non-nil empty map is still sent as {}.
SDKMajorVersions map[string]string `json:"sdkMajorVersions,omitzero"`
}
FunctionExecutorRequest represents an ad-hoc function execution request
type FunctionExecutorResponse ¶
type FunctionExecutorResponse struct {
Result interface{} `json:"result"`
Logs string `json:"logs"`
}
FunctionExecutorResponse represents an ad-hoc function execution response
type FunctionHandler ¶
type FunctionHandler struct {
// contains filtered or unexported fields
}
FunctionHandler handles App Engine function operations
func NewFunctionHandler ¶
func NewFunctionHandler(c *httpclient.Client) *FunctionHandler
NewFunctionHandler creates a new function handler
func (*FunctionHandler) DeferExecution ¶
func (h *FunctionHandler) DeferExecution(ctx context.Context, req *DeferredExecutionRequest) (*DeferredExecutionResponse, error)
DeferExecution defers execution of a resumable function
func (*FunctionHandler) ExecuteCode ¶
func (h *FunctionHandler) ExecuteCode(ctx context.Context, sourceCode, payload string) (*FunctionExecutorResponse, error)
ExecuteCode executes ad-hoc JavaScript code using the function executor
func (*FunctionHandler) ExecuteRequest ¶
func (h *FunctionHandler) ExecuteRequest(ctx context.Context, req *FunctionExecutorRequest) (*FunctionExecutorResponse, error)
ExecuteRequest executes a prepared ad-hoc function executor request, for callers that set fields beyond the source code and payload.
func (*FunctionHandler) GetSDKVersions ¶
func (h *FunctionHandler) GetSDKVersions(ctx context.Context) (*SDKVersionsResponse, error)
GetSDKVersions lists available SDK versions
func (*FunctionHandler) InvokeFunction ¶
func (h *FunctionHandler) InvokeFunction(ctx context.Context, req *FunctionInvokeRequest) (*FunctionInvokeResponse, error)
InvokeFunction invokes an app function
type FunctionInvokeRequest ¶
type FunctionInvokeRequest struct {
Method string // HTTP method (GET, POST, PUT, PATCH, DELETE)
AppID string // App ID
FunctionName string // Function name
Payload string // Request body/payload
Headers map[string]string // Additional headers
}
FunctionInvokeRequest represents a function invocation request
type FunctionInvokeResponse ¶
type FunctionInvokeResponse struct {
StatusCode int `json:"statusCode"`
Headers map[string]string `json:"headers,omitempty"`
Body string `json:"body"`
RawBody interface{} `json:"-"` // For direct JSON output
}
FunctionInvokeResponse represents a function invocation response
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles App Engine resources
func NewHandler ¶
func NewHandler(c *httpclient.Client) *Handler
NewHandler creates a new App Engine handler
func (*Handler) GetAction ¶
GetAction returns a single action addressed as "app-id:action-name", the form workflow definitions use.
func (*Handler) GetFunction ¶
GetFunction gets details about a specific function
func (*Handler) ListActions ¶
ListActions lists the actions of installed apps.
Query and Filter are sent upstream; AppID is applied here, so it needs no filter-expression quoting and cannot collide with a caller's Filter.
func (*Handler) ListFunctions ¶
ListFunctions lists all functions across apps (or filtered by app ID)
type ListActionsOptions ¶
type ListActionsOptions struct {
// AppID keeps only the actions of one app, by exact id.
AppID string
// Query is a whitespace-separated list of search terms. Each term must
// appear in the app id, app name, action name, title or description;
// terms are case-insensitive and each one narrows further.
Query string
// Filter is a platform filter expression on app.id and the action's
// fields, nested paths included, e.g.
// "not (action.docs.inputSchema is-empty)". It is sent as is; combined
// with Query, an action must match both.
Filter string
}
ListActionsOptions narrows what ListActions returns.
type ModificationInfo ¶
type ModificationInfo struct {
CreatedBy string `json:"createdBy,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
LastModifiedBy string `json:"lastModifiedBy,omitempty"`
LastModifiedAt string `json:"lastModifiedAt,omitempty"`
}
ModificationInfo contains modification timestamps
type ResourceStatus ¶
type ResourceStatus struct {
Status string `json:"status"`
SubResourceTypes []string `json:"subResourceTypes,omitempty"`
SubResourceStatuses []string `json:"subResourceStatuses,omitempty"`
}
ResourceStatus represents the status of an app's resources
type SDKVersionsResponse ¶
type SDKVersionsResponse struct {
LayerVersion string `json:"layerVersion"`
Packages map[string][]string `json:"packages"`
}
SDKVersionsResponse represents the SDK versions response: the SDK layer version plus, per SDK package, every version the function executor offers.
type SignatureInfo ¶
type SignatureInfo struct {
Signature string `json:"signature,omitempty"`
}
SignatureInfo represents signature information for an app