Documentation
¶
Overview ¶
Package pluginkit is the shared scaffolding for first-party notification channel plugins. It speaks only the public plugin contract (pluginpb).
Index ¶
- func BaseURL(raw string, allowHTTP bool) (*url.URL, error)
- func Main(p Plugin)
- func NewServer(p Plugin) *grpc.Server
- func ParseConfig(raw json.RawMessage, into any) error
- func Redact(s string, secrets ...string) string
- func RetryAfter(header string, body []byte) time.Duration
- func Snippet(body []byte) string
- func Text(ev *pluginpb.Event) string
- func Truncate(s string, n int) string
- type Accept
- type Call
- type DNSCall
- type DNSOutcome
- type DNSProvider
- type HTTP
- type Plugin
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BaseURL ¶
BaseURL validates an operator-supplied service address: https only unless allowHTTP, a host, and no embedded credentials.
func Main ¶
func Main(p Plugin)
Main serves p on the unix socket named by PLUGIN_SOCKET until SIGTERM.
func ParseConfig ¶
func ParseConfig(raw json.RawMessage, into any) error
ParseConfig decodes the plugin-wide config strictly.
func RetryAfter ¶
RetryAfter reads a Retry-After header in seconds, or a JSON retry_after_ms.
Types ¶
type Call ¶
type Call struct {
Event *pluginpb.Event
Config json.RawMessage
Secret string
}
Call is one delivery request: the event, the plugin-wide config and the per-call credential, which a plugin must never store or log.
type DNSCall ¶
DNSCall is the config and per-call credential every DNS operation receives. The secret must never be stored or logged by the plugin.
type DNSOutcome ¶
DNSOutcome is the plugin's verdict on one DNS operation.
type DNSProvider ¶
type DNSProvider struct {
ListZones func(ctx context.Context, c DNSCall) ([]string, DNSOutcome)
ListRecords func(ctx context.Context, c DNSCall) ([]*pluginpb.DnsRecord, DNSOutcome)
Upsert func(ctx context.Context, c DNSCall) DNSOutcome
Delete func(ctx context.Context, c DNSCall) DNSOutcome
Verify func(ctx context.Context, c DNSCall) (bool, DNSOutcome)
}
DNSProvider implements the dns_provider contract for one DNS service.
type HTTP ¶
type HTTP struct {
Client *http.Client
Retries int
Backoff time.Duration
Sleep func(ctx context.Context, d time.Duration) error
}
HTTP delivers one request with bounded retries and maps failures to Results.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package pluginkittest holds the checks every first-party plugin test shares.
|
Package pluginkittest holds the checks every first-party plugin test shares. |