Documentation
¶
Overview ¶
Package native runs native plugins over mutually authenticated go-plugin gRPC.
Index ¶
- Constants
- func CheckDescription(expected, actual *pluginv1.DescribeResponse) error
- type Handle
- type Option
- func WithAPI(server *bridge.Server) Option
- func WithCallTimeout(timeout time.Duration) Option
- func WithDescription(expected *pluginv1.DescribeResponse) Option
- func WithDirectory(directory string) Option
- func WithEnvironment(environment []string) Option
- func WithInteractionLimit(limit time.Duration) Option
- func WithPackageAlias(alias string) Option
- func WithStartTimeout(timeout time.Duration) Option
Constants ¶
const DefaultInteractionLimit = 15 * time.Minute
DefaultInteractionLimit is how long an interactive invocation may wait for the user, on top of its call timeout. It matches the longest device-code lifetime common identity providers issue.
Variables ¶
This section is empty.
Functions ¶
func CheckDescription ¶
func CheckDescription(expected, actual *pluginv1.DescribeResponse) error
CheckDescription rejects binaries that disagree with their installed manifest.
Types ¶
type Handle ¶
type Handle struct {
Info pluginv1.InfoClient
Provider pluginv1.AuthProviderClient
Identity pluginv1.AuthIdentityClient
Commands pluginv1.CommandsClient
Discovery pluginv1.ComponentDiscoveryClient
Validation pluginv1.ComponentValidationClient
Preparation pluginv1.ComponentPreparationClient
State pluginv1.ComponentStateClient
// contains filtered or unexported fields
}
Handle owns a native process and its versioned service clients.
func (*Handle) AwaitUser ¶
AwaitUser marks the invocation as waiting for the user, such as after a device-code prompt was shown, and returns the function that ends the wait. While any wait is open the call timeout does not run; the hard deadline still applies. The returned function is idempotent, and both are no-ops for an unknown invocation or one without a call timeout.
func (*Handle) Close ¶
func (h *Handle) Close()
Close terminates the process, its process group, the broker, and active callback streams.
func (*Handle) Command ¶
func (h *Handle) Command(ctx context.Context, request *pluginv1.CommandRequest, stdout, stderr io.Writer) error
Command runs an export and validates its terminal event before accepting its exit status. Writers must come from Atmos's masked I/O layer when attached to a terminal.
func (*Handle) Invoke ¶
func (h *Handle) Invoke(ctx context.Context, scope bridge.Invocation, run func(context.Context, *pluginv1.Invocation) error) error
Invoke grants API access for one operation and drains callbacks before returning. The operation is cancelled by its caller, by SIGINT or SIGTERM, or by the call timeout; in every case the plugin process is stopped rather than left running. For an interactive invocation the call timeout pauses while Atmos waits for the user (see AwaitUser).
type Option ¶
type Option func(*options)
Option configures the native process without inheriting the CLI's secrets.
func WithCallTimeout ¶
WithCallTimeout bounds every invocation made through the handle. The deadline is sent to the plugin, and the plugin process is stopped when it passes. Zero or negative disables it. For an interactive invocation, time spent waiting for the user (see Handle.AwaitUser) does not count against the timeout; WithInteractionLimit bounds that wait instead.
func WithDescription ¶
func WithDescription(expected *pluginv1.DescribeResponse) Option
WithDescription binds the process handshake to statically verified metadata.
func WithDirectory ¶
WithDirectory sets the plugin process working directory.
func WithEnvironment ¶
WithEnvironment supplies explicitly approved process environment entries.
func WithInteractionLimit ¶
WithInteractionLimit bounds the time an interactive invocation may spend waiting for the user to complete a sign-in. That wait does not count against the call timeout, but the call's hard deadline is the call timeout plus this limit. Zero or negative keeps DefaultInteractionLimit.
func WithPackageAlias ¶
WithPackageAlias names the package's key under plugins.packages so errors can point at the configuration that controls them, such as plugins.packages.<alias>.interaction_timeout.
func WithStartTimeout ¶
WithStartTimeout bounds the plugin handshake and initial configuration RPCs.