Documentation
¶
Index ¶
- Constants
- func ReadFileOrStdin(filename string) (string, error)
- func ReadFileOrStdinWith(env vfs.Env, filename string) (string, error)
- type App
- type AppAction
- type AppFunction
- type AppList
- type DeferredExecutionRequest
- type DeferredExecutionResponse
- type FunctionExecutorRequest
- type FunctionExecutorResponse
- type FunctionHandler
- func (h *FunctionHandler) DeferExecution(req *DeferredExecutionRequest) (*DeferredExecutionResponse, error)
- func (h *FunctionHandler) DiscoverSchema(appID, functionName string) (*FunctionSchema, error)
- func (h *FunctionHandler) ExecuteRequest(req *FunctionExecutorRequest) (*FunctionExecutorResponse, error)
- func (h *FunctionHandler) GetSDKVersions() (*SDKVersionsResponse, error)
- func (h *FunctionHandler) InvokeFunction(req *FunctionInvokeRequest) (*FunctionInvokeResponse, error)
- type FunctionInvokeRequest
- type FunctionInvokeResponse
- type FunctionSchema
- type Handler
- func (h *Handler) DeleteApp(appID string) error
- func (h *Handler) GetAction(fullName string) (*AppAction, error)
- func (h *Handler) GetApp(appID string) (*App, error)
- func (h *Handler) GetFunction(fullName string) (*AppFunction, error)
- func (h *Handler) ListActions(opts ListActionsOptions) ([]AppAction, error)
- func (h *Handler) ListApps() (*AppList, error)
- func (h *Handler) ListFunctions(appIDFilter string) ([]AppFunction, error)
- type Intent
- type IntentHandler
- func (h *IntentHandler) FindIntentsForData(data map[string]interface{}) ([]IntentMatch, error)
- func (h *IntentHandler) GenerateIntentURL(appID, intentID string, payload map[string]interface{}) (string, error)
- func (h *IntentHandler) GetIntent(fullName string) (*Intent, error)
- func (h *IntentHandler) ListIntents(appIDFilter string) ([]Intent, error)
- type IntentMatch
- type IntentProperty
- type ListActionsOptions
- type ModificationInfo
- type ResourceStatus
- type SDKVersionsResponse
- type SchemaField
- type SignatureInfo
Constants ¶
const ( MaxActionQueryLength = sdkae.MaxActionQueryLength MaxActionFilterLength = sdkae.MaxActionFilterLength )
Variables ¶
This section is empty.
Functions ¶
func ReadFileOrStdin ¶
ReadFileOrStdin reads content from a file (through the vfs seam, so embedded invocations resolve virtual request files) or stdin. This is a CLI-layer helper and intentionally not part of the SDK.
Types ¶
type App ¶
type App struct {
ID string `json:"id" table:"ID"`
Name string `json:"name" table:"NAME"`
Version string `json:"version" table:"VERSION"`
Description string `json:"description" table:"DESCRIPTION,wide"`
IsBuiltin bool `json:"isBuiltin,omitempty" table:"BUILTIN,wide"`
ResourceStatus *ResourceStatus `json:"resourceStatus,omitempty" table:"-"`
SignatureInfo *SignatureInfo `json:"signatureInfo,omitempty" table:"-"`
Manifest map[string]interface{} `json:"manifest,omitempty" table:"-"`
ModificationInfo *ModificationInfo `json:"modificationInfo,omitempty" table:"-"`
}
App represents an installed app (CLI version with table tags).
type AppAction ¶
type AppAction struct {
AppID string `json:"appId" yaml:"appId" table:"APP_ID"`
ActionName string `json:"actionName" yaml:"actionName" table:"ACTION"`
Title string `json:"title,omitempty" yaml:"title,omitempty" table:"TITLE"`
Description string `json:"description,omitempty" yaml:"description,omitempty" table:"DESCRIPTION,wide"`
Stateful bool `json:"stateful,omitempty" yaml:"stateful,omitempty" table:"STATEFUL,wide"`
Approval bool `json:"approval,omitempty" yaml:"approval,omitempty" table:"APPROVAL,wide"`
FullName string `json:"fullName" yaml:"fullName" table:"FULL_NAME"`
// Extra holds the manifest attributes with no typed field; MarshalJSON
// emits them inline.
Extra map[string]json.RawMessage `json:"-" yaml:"-" table:"-"`
}
func (AppAction) MarshalJSON ¶
MarshalJSON emits the modelled fields, then each Extra attribute under its own name. A manifest attribute that collides with a modelled field is dropped: the typed field wins.
func (AppAction) MarshalYAML ¶
type AppFunction ¶
type AppFunction struct {
AppID string `json:"appId" table:"APP_ID,wide"`
AppName string `json:"appName" table:"APP"`
FunctionName string `json:"functionName" table:"FUNCTION"`
Title string `json:"title,omitempty" table:"TITLE,wide"`
Description string `json:"description,omitempty" table:"DESCRIPTION,wide"`
Resumable bool `json:"resumable" table:"RESUMABLE,wide"`
Stateful bool `json:"stateful,omitempty" table:"STATEFUL,wide"`
FullName string `json:"fullName" table:"FULL_NAME"`
}
AppFunction represents a function within an app (CLI version with table tags).
type DeferredExecutionRequest ¶
type DeferredExecutionRequest = sdkae.DeferredExecutionRequest
Re-export SDK types that have no table tags.
type DeferredExecutionResponse ¶
type DeferredExecutionResponse struct {
ID string `json:"id" table:"ID"`
}
DeferredExecutionResponse represents a deferred execution response (CLI version with table tags).
type FunctionExecutorRequest ¶
type FunctionExecutorRequest = sdkae.FunctionExecutorRequest
Re-export SDK types that have no table tags.
type FunctionExecutorResponse ¶
type FunctionExecutorResponse = sdkae.FunctionExecutorResponse
Re-export SDK types that have no table tags.
type FunctionHandler ¶
type FunctionHandler struct {
// contains filtered or unexported fields
}
FunctionHandler handles App Engine function operations.
func NewFunctionHandler ¶
func NewFunctionHandler(c *client.Client) *FunctionHandler
NewFunctionHandler creates a new function handler
func (*FunctionHandler) DeferExecution ¶
func (h *FunctionHandler) DeferExecution(req *DeferredExecutionRequest) (*DeferredExecutionResponse, error)
DeferExecution defers execution of a resumable function
func (*FunctionHandler) DiscoverSchema ¶
func (h *FunctionHandler) DiscoverSchema(appID, functionName string) (*FunctionSchema, error)
DiscoverSchema attempts to discover the schema of a function by calling it with an empty payload
func (*FunctionHandler) ExecuteRequest ¶
func (h *FunctionHandler) ExecuteRequest(req *FunctionExecutorRequest) (*FunctionExecutorResponse, error)
ExecuteRequest executes a prepared ad-hoc function executor request
func (*FunctionHandler) GetSDKVersions ¶
func (h *FunctionHandler) GetSDKVersions() (*SDKVersionsResponse, error)
GetSDKVersions lists available SDK versions as returned by the function executor
func (*FunctionHandler) InvokeFunction ¶
func (h *FunctionHandler) InvokeFunction(req *FunctionInvokeRequest) (*FunctionInvokeResponse, error)
InvokeFunction invokes an app function
type FunctionInvokeRequest ¶
type FunctionInvokeRequest = sdkae.FunctionInvokeRequest
Re-export SDK types that have no table tags.
type FunctionInvokeResponse ¶
type FunctionInvokeResponse = sdkae.FunctionInvokeResponse
Re-export SDK types that have no table tags.
type FunctionSchema ¶
type FunctionSchema struct {
FunctionName string
AppID string
Fields []SchemaField
ErrorMessage string
}
FunctionSchema represents the discovered schema of a function
func (*FunctionSchema) FormatSchema ¶
func (s *FunctionSchema) FormatSchema() string
FormatSchema formats a schema for display
func (*FunctionSchema) GenerateExamplePayload ¶
func (s *FunctionSchema) GenerateExamplePayload() string
GenerateExamplePayload generates an example JSON payload based on discovered schema
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles App Engine resources.
func NewHandler ¶
NewHandler creates a new App Engine handler
func (*Handler) GetFunction ¶
func (h *Handler) GetFunction(fullName string) (*AppFunction, error)
GetFunction gets details about a specific function
func (*Handler) ListActions ¶
func (h *Handler) ListActions(opts ListActionsOptions) ([]AppAction, error)
func (*Handler) ListFunctions ¶
func (h *Handler) ListFunctions(appIDFilter string) ([]AppFunction, error)
ListFunctions lists all functions across apps (or filtered by app ID)
type Intent ¶
type Intent struct {
AppID string `json:"appId" table:"APP_ID,wide"`
AppName string `json:"appName" table:"APP"`
IntentID string `json:"intentId" table:"INTENT_ID"`
Description string `json:"description" table:"DESCRIPTION"`
Properties map[string]IntentProperty `json:"properties,omitempty" table:"-"`
FullName string `json:"fullName" table:"FULL_NAME"`
RequiredProps []string `json:"requiredProps,omitempty" table:"REQUIRED"`
// Name is the declaration's human-readable label, as declared.
Name string `json:"name,omitempty" yaml:",omitempty" table:"-"`
// Deprecated is true when the app marks the intent deprecated.
Deprecated bool `json:"deprecated,omitempty" yaml:",omitempty" table:"-"`
// DeprecationMessage is the app's note when `deprecated` is a string.
DeprecationMessage string `json:"deprecationMessage,omitempty" yaml:",omitempty" table:"-"`
}
Intent represents an app intent from the manifest
func (Intent) SortedPropertyNames ¶
SortedPropertyNames returns the intent's property names in sorted order.
type IntentHandler ¶
type IntentHandler struct {
// contains filtered or unexported fields
}
IntentHandler handles App Engine intent operations
func NewIntentHandler ¶
func NewIntentHandler(c *client.Client) *IntentHandler
NewIntentHandler creates a new intent handler
func (*IntentHandler) FindIntentsForData ¶
func (h *IntentHandler) FindIntentsForData(data map[string]interface{}) ([]IntentMatch, error)
FindIntentsForData finds intents that match the given data
func (*IntentHandler) GenerateIntentURL ¶
func (h *IntentHandler) GenerateIntentURL(appID, intentID string, payload map[string]interface{}) (string, error)
GenerateIntentURL generates an intent URL for the given app, intent, and payload
func (*IntentHandler) GetIntent ¶
func (h *IntentHandler) GetIntent(fullName string) (*Intent, error)
GetIntent gets details about a specific intent
func (*IntentHandler) ListIntents ¶
func (h *IntentHandler) ListIntents(appIDFilter string) ([]Intent, error)
ListIntents lists all intents across apps (or filtered by app ID)
type IntentMatch ¶
type IntentMatch struct {
Intent
MatchQuality float64 `json:"matchQuality" table:"MATCH%"`
MatchedProps []string `json:"matchedProps,omitempty" table:"-"`
MissingProps []string `json:"missingProps,omitempty" table:"-"`
// MatchedKeys maps each matched property to the key in the data that
// satisfied it: the key to send when opening the intent.
MatchedKeys map[string]string `json:"matchedKeys,omitempty" yaml:",omitempty" table:"-"`
}
IntentMatch represents a matched intent with quality score
type IntentProperty ¶
type IntentProperty struct {
// Type is the declared JSON-schema type. It is empty when the declaration
// names none: dtctl does not guess one. A list-form type
// (`type: ["string", "array"]`), or different types across the keys of a
// plural `schemas` declaration, is joined with "|"; Types has the list.
Type string `json:"type"`
Required bool `json:"required"`
Format string `json:"format,omitempty"`
Description string `json:"description,omitempty"`
// Types lists every declared type without duplicates, in declaration
// order (for `schemas`, in accepted-key order).
Types []string `json:"types,omitempty" yaml:",omitempty"`
// AcceptedKeys are the payload keys that satisfy this property: the
// property name for the singular form, the `schemas` keys (sorted) for
// the plural one. Always present; an empty list means the app declared
// `schemas: {}`, which no payload can satisfy.
AcceptedKeys []string `json:"acceptedKeys"`
// Schema is the singular `schema` exactly as declared (pattern, enum,
// items, nested properties and required, ...).
Schema map[string]interface{} `json:"schema,omitempty" yaml:",omitempty"`
// Schemas is the plural `schemas` map exactly as declared, keyed by
// accepted payload key.
Schemas map[string]interface{} `json:"schemas,omitempty" yaml:",omitempty"`
}
IntentProperty represents a property definition in an intent.
An app declares a property in one of two forms:
- singular `schema`: the property name is the payload key, governed by that one schema;
- plural `schemas`: a map whose keys are the payload keys the intent accepts for this property (aliases such as `dt.entity` or `id`), each with its own schema. The property name is then only a label: a payload can carry it only when it is also one of the keys.
Type, Required, Format and Description predate the plural form and keep their meaning. Everything else the declaration carries is exposed next to them rather than folded into them, so -o json/yaml show what the app declared.
func (IntentProperty) KeyPattern ¶
func (p IntentProperty) KeyPattern(propName, key string) string
KeyPattern returns the `pattern` the schema of one accepted key declares, or "" when it declares none.
type ListActionsOptions ¶
type ListActionsOptions = sdkae.ListActionsOptions
type ModificationInfo ¶
type ModificationInfo = sdkae.ModificationInfo
Re-export SDK types that have no table tags.
type ResourceStatus ¶
type ResourceStatus = sdkae.ResourceStatus
Re-export SDK types that have no table tags.
type SDKVersionsResponse ¶
type SDKVersionsResponse = sdkae.SDKVersionsResponse
Re-export SDK types that have no table tags.
type SchemaField ¶
SchemaField represents a field in the function schema
type SignatureInfo ¶
type SignatureInfo = sdkae.SignatureInfo
Re-export SDK types that have no table tags.