Documentation
¶
Overview ¶
Package pluginsdk is the stable, supported API for building recur trigger plugins. External plugin repositories import this package instead of reaching into core internals under src/infra, so the plugin contract can evolve behind a curated surface without breaking out-of-tree plugins.
A trigger plugin is a subprocess that recur launches. It reads its trigger configuration as JSON from stdin, dials the daemon at the Unix socket named by the RECUR_SOCKET environment variable, and reports fired events for the trigger identified by RECUR_TRIGGER_ID:
client, err := pluginsdk.Connect(os.Getenv("RECUR_SOCKET"))
if err != nil {
log.Fatal(err)
}
defer client.Close()
resp, err := client.Service.ReportTriggerEvent(ctx, &pluginsdk.ReportTriggerEventRequest{
TriggerId: os.Getenv("RECUR_TRIGGER_ID"),
Context: map[string]string{"Key": "value"},
})
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client = clientgrpc.Client
Client is a connection to the recur daemon over its gRPC socket. Report fired events through the embedded Service and close the connection on shutdown.
func Connect ¶
Connect dials the recur daemon at the given Unix socket path (typically the value of RECUR_SOCKET). It returns an error if the daemon is not reachable within a few seconds.
func ConnectOrNil ¶
ConnectOrNil dials the daemon like Connect but returns nil (no error) when the daemon is unreachable, for callers that can operate without it.
type RecurClient ¶
type RecurClient = recurv1.RecurServiceClient
RecurClient is the daemon RPC surface reachable via Client.Service.
type ReportTriggerEventRequest ¶
type ReportTriggerEventRequest = recurv1.ReportTriggerEventRequest
ReportTriggerEventRequest reports that a trigger fired. TriggerId identifies the trigger (the RECUR_TRIGGER_ID environment variable) and Context carries the trigger's context variables.
type ReportTriggerEventResponse ¶
type ReportTriggerEventResponse = recurv1.ReportTriggerEventResponse
ReportTriggerEventResponse is the daemon's reply to a reported event. Accepted reports whether the daemon acted on the event; Error explains a rejection.