native

package
v1.235.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 27 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package native runs native plugins over mutually authenticated go-plugin gRPC.

Index

Constants

View Source
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 Start

func Start(ctx context.Context, executable string, opts ...Option) (*Handle, error)

Start launches a plugin with gRPC-only transport and ephemeral mutual TLS.

func (*Handle) AwaitUser

func (h *Handle) AwaitUser(invocationID string) (resume func())

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 WithAPI

func WithAPI(server *bridge.Server) Option

WithAPI provides the invocation-scoped Atmos API server.

func WithCallTimeout

func WithCallTimeout(timeout time.Duration) Option

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

func WithDirectory(directory string) Option

WithDirectory sets the plugin process working directory.

func WithEnvironment

func WithEnvironment(environment []string) Option

WithEnvironment supplies explicitly approved process environment entries.

func WithInteractionLimit

func WithInteractionLimit(limit time.Duration) Option

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

func WithPackageAlias(alias string) Option

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

func WithStartTimeout(timeout time.Duration) Option

WithStartTimeout bounds the plugin handshake and initial configuration RPCs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL