Documentation
¶
Overview ¶
Package plugin provides the Go SDK for building dex adapters.
An adapter author implements the Adapter interface and calls Serve to start the plugin binary. The host side (dex engine) calls Open to connect. Neither side ever touches the generated protobuf types or JSON directly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Handshake = goplugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "DEX_PLUGIN",
MagicCookieValue: "dex-plugin-v1",
}
Handshake is the shared handshake configuration both Serve and Open use. ProtocolVersion must match on both sides; the magic cookie guards against accidentally launching a non-plugin binary.
Functions ¶
func CollectResult ¶
func CollectResult(name string, stream grpc.ServerStreamingClient[pb.ApplyResponse], rep Reporter) (map[string]any, error)
CollectResult reads a server-streaming response, dispatching LOG/PROGRESS to the Reporter and returning the terminal SUCCESS/ERROR result. It is exported so adapter authors can use it in their own test helpers.
Types ¶
type Adapter ¶
type Adapter interface {
// Apply creates or updates a resource. An empty Prior means create.
// It returns the new state (outputs) for persistence, or an error.
Apply(ctx context.Context, req Request, r Reporter) (map[string]any, error)
// Destroy tears down a resource.
Destroy(ctx context.Context, req Request, r Reporter) error
}
Adapter is the interface a dex adapter binary implements.
type Reporter ¶
type Reporter interface {
// Log sends a human-readable log message.
Log(msg string)
// Progress reports a percentage estimate (0-100).
Progress(pct int)
}
Reporter receives intermediate progress from an Adapter operation.
type Request ¶
type Request struct {
// Name is the resource identifier from the IR.
Name string
// Type is the adapter resource type (e.g. "docker", "http").
Type string
// Properties is the desired state.
Properties map[string]any
// Prior is the previous desired state (nil for create).
Prior map[string]any
// Outputs is the resource outputs from state (only meaningful for Destroy).
Outputs map[string]any
}
Request carries a resource operation's parameters in Go-native types.