providerapi

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestEnvVar           = "LSSH_PROVIDER_REQUEST"
	ResultEnvVar            = "LSSH_PROVIDER_RESULT"
	RuntimeBridgeAddrEnvVar = "LSSH_PROVIDER_BRIDGE_ADDR"
)
View Source
const (
	MethodPluginDescribe    = "plugin.describe"
	MethodInventoryList     = "inventory.list"
	MethodSecretGet         = "secret.get"
	MethodHealthCheck       = "health.check"
	MethodConnectorDescribe = "connector.describe"
	MethodConnectorPrepare  = "connector.prepare"
	MethodConnectorShell    = "connector.shell"
	MethodConnectorExec     = "connector.exec"
	MethodConnectorDial     = "connector.dial"
	// MethodTransportPrep is kept as a legacy alias while the connector API
	// moves from transport.* naming to connector.* naming.
	MethodTransportPrep = "transport.prepare"
)
View Source
const Version = "v1"

Variables

This section is empty.

Functions

func ExpandPath

func ExpandPath(path string) string

func ExpandPaths

func ExpandPaths(paths []string) []string

func ResolveConfigValue

func ResolveConfigValue(raw map[string]interface{}, key string) (string, error)

func Run

func Run(name string, args ...string) ([]byte, error)

func RunWithEnv

func RunWithEnv(env []string, name string, args ...string) ([]byte, error)

func String

func String(raw map[string]interface{}, key string) string

func StringSlice

func StringSlice(raw map[string]interface{}, key string) []string

func WriteError

func WriteError(message string) error

func WriteErrorResponse

func WriteErrorResponse(req Request, code, message string) error

func WriteResponse

func WriteResponse(req Request, result interface{}, warnings []Warning) error

func WriteResult

func WriteResult(v interface{}) error

func WriteRuntimeResult

func WriteRuntimeResult(v interface{}) error

Types

type ConnectorCapability

type ConnectorCapability struct {
	Supported   bool                   `json:"supported"`
	Reason      string                 `json:"reason,omitempty"`
	Constraints map[string]interface{} `json:"constraints,omitempty"`
	Requires    []string               `json:"requires,omitempty"`
	Preferred   bool                   `json:"preferred,omitempty"`
}

type ConnectorDescribeParams

type ConnectorDescribeParams struct {
	Provider string                 `json:"provider"`
	Config   map[string]interface{} `json:"config,omitempty"`
	Target   ConnectorTarget        `json:"target"`
}

type ConnectorDescribeResult

type ConnectorDescribeResult struct {
	Capabilities map[string]ConnectorCapability `json:"capabilities,omitempty"`
}

type ConnectorExecResult

type ConnectorExecResult struct {
	ExitCode int `json:"exit_code"`
}

type ConnectorOperation

type ConnectorOperation struct {
	Name    string                 `json:"name"`
	Command []string               `json:"command,omitempty"`
	Env     map[string]string      `json:"env,omitempty"`
	Cwd     string                 `json:"cwd,omitempty"`
	PTY     bool                   `json:"pty,omitempty"`
	Options map[string]interface{} `json:"options,omitempty"`
}

type ConnectorPlan

type ConnectorPlan struct {
	Kind    string                 `json:"kind"`
	Program string                 `json:"program,omitempty"`
	Args    []string               `json:"args,omitempty"`
	Env     map[string]string      `json:"env,omitempty"`
	Details map[string]interface{} `json:"details,omitempty"`
}

type ConnectorPrepareParams

type ConnectorPrepareParams struct {
	Provider  string                 `json:"provider"`
	Config    map[string]interface{} `json:"config,omitempty"`
	Target    ConnectorTarget        `json:"target"`
	Operation ConnectorOperation     `json:"operation"`
}

type ConnectorPrepareResult

type ConnectorPrepareResult struct {
	Supported bool          `json:"supported"`
	Plan      ConnectorPlan `json:"plan,omitempty"`
}

type ConnectorRuntimeParams

type ConnectorRuntimeParams struct {
	Provider       string                 `json:"provider"`
	Config         map[string]interface{} `json:"config,omitempty"`
	Target         ConnectorTarget        `json:"target"`
	Plan           ConnectorPlan          `json:"plan"`
	LocalRCCommand string                 `json:"local_rc_command,omitempty"`
	StartupMarker  string                 `json:"startup_marker,omitempty"`
}

type ConnectorTarget

type ConnectorTarget struct {
	Name   string                 `json:"name,omitempty"`
	Config map[string]interface{} `json:"config,omitempty"`
	Meta   map[string]string      `json:"meta,omitempty"`
}

type Error

type Error struct {
	Code      string                 `json:"code,omitempty"`
	Message   string                 `json:"message"`
	Details   map[string]interface{} `json:"details,omitempty"`
	Retryable bool                   `json:"retryable,omitempty"`
}

type HealthCheckParams

type HealthCheckParams struct {
	Provider string                 `json:"provider"`
	Config   map[string]interface{} `json:"config,omitempty"`
}

type HealthCheckResult

type HealthCheckResult struct {
	OK      bool   `json:"ok"`
	Message string `json:"message,omitempty"`
}

type InventoryListParams

type InventoryListParams struct {
	Provider string                 `json:"provider"`
	Config   map[string]interface{} `json:"config,omitempty"`
}

type InventoryListResult

type InventoryListResult struct {
	Servers []InventoryServer `json:"servers,omitempty"`
}

type InventoryServer

type InventoryServer struct {
	Name   string                 `json:"name"`
	Config map[string]interface{} `json:"config,omitempty"`
	Meta   map[string]string      `json:"meta,omitempty"`
}

type PluginDescribeResult

type PluginDescribeResult struct {
	Name            string   `json:"name"`
	Capabilities    []string `json:"capabilities,omitempty"`
	ConnectorNames  []string `json:"connector_names,omitempty"`
	Methods         []string `json:"methods,omitempty"`
	ReservedKeys    []string `json:"reserved_keys,omitempty"`
	ProtocolVersion string   `json:"protocol_version,omitempty"`
	PluginVersion   string   `json:"plugin_version,omitempty"`
}

type Request

type Request struct {
	Version string      `json:"version"`
	ID      string      `json:"id,omitempty"`
	Method  string      `json:"method"`
	Params  interface{} `json:"params,omitempty"`
}

func ReadRequest

func ReadRequest() (Request, error)

type Response

type Response struct {
	Version  string          `json:"version"`
	ID       string          `json:"id,omitempty"`
	Result   json.RawMessage `json:"result,omitempty"`
	Error    *Error          `json:"error,omitempty"`
	Warnings []Warning       `json:"warnings,omitempty"`
}

type SecretGetParams

type SecretGetParams struct {
	Provider string                 `json:"provider"`
	Config   map[string]interface{} `json:"config,omitempty"`
	Ref      string                 `json:"ref"`
	Server   string                 `json:"server,omitempty"`
	Field    string                 `json:"field,omitempty"`
}

type SecretGetResult

type SecretGetResult struct {
	Value string `json:"value"`
	Type  string `json:"type,omitempty"`
}

type Warning

type Warning struct {
	Code    string `json:"code,omitempty"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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