Documentation
¶
Overview ¶
Package epcmd is manage_script's endpoint binding commands (#2171): endpoint_set, endpoint_list, endpoint_enable and endpoint_disable, beside the schedule commands. internal/platform/scriptlayer resolves the script a command names, as it does for every command, and hands it here with who is asking; the input fields and their schema are spliced into manage_script's own.
Index ¶
Constants ¶
const ( CmdSet = "endpoint_set" CmdList = "endpoint_list" CmdEnable = "endpoint_enable" CmdDisable = "endpoint_disable" )
The commands.
Variables ¶
var Commands = []string{CmdSet, CmdList, CmdEnable, CmdDisable}
Commands is every endpoint command, in the order the schema lists them.
var ErrStore = errors.New("the endpoint store failed")
ErrStore marks a command that failed because a store could not be read or written, which is the platform's failure rather than the caller's.
Functions ¶
func Properties ¶
Properties is the schema fragment manage_script splices in for the fields of Input.
Types ¶
type Handler ¶
type Handler struct {
Store epbinding.Store
// PublicAllowed reports whether the deployment lets a public endpoint be
// bound (internal/botcheck).
PublicAllowed func(ctx context.Context) (bool, error)
// BaseURL is the deployment's public address, empty when it has none.
BaseURL string
// ScriptName names a script a listing found by id; nil leaves names out.
ScriptName func(ctx context.Context, scriptID string) string
}
Handler carries the commands out.
type Input ¶
type Input struct {
Endpoint string `json:"endpoint,omitempty"`
Methods []string `json:"methods,omitempty"`
Path *string `json:"path,omitempty"`
AuthMode string `json:"auth_mode,omitempty"`
OpenReads *bool `json:"open_reads,omitempty"`
MaxMemoryBytes int64 `json:"max_memory_bytes,omitempty"`
MaxBodyBytes int `json:"max_body_bytes,omitempty"`
AllowedOrigins []string `json:"allowed_origins,omitempty"`
RateLimit int `json:"rate_limit,omitempty"`
CallerRateLimit int `json:"caller_rate_limit,omitempty"`
}
Input is the part of manage_script's input the endpoint commands read. endpoint_set also reads manage_script's timeout_seconds.
type Request ¶
type Request struct {
Command string
Input Input
// TimeoutSeconds is manage_script's timeout_seconds.
TimeoutSeconds int
// Script is the script the command names, nil for a listing that names
// none.
Script *script.Script
// Visible scopes a listing that names no script to the scripts the caller
// may see; nil for an administrator, whose listing is every binding.
Visible map[string]*script.Script
Admin bool
Actor string
}
Request is one endpoint command.