plugin

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: AGPL-3.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 plugin transports resource v2 providers over bounded, validated gRPC messages.

Index

Constants

View Source
const (
	// MaxWireBytes bounds the entire raw resource protobuf frame before decoding.
	MaxWireBytes = resourcev2.MaxMessageBytes
	// MaxBodyBytes bounds scalar payloads and encoded resource Value documents.
	MaxBodyBytes = resourcev2.MaxDocumentBytes
	// MaxDepth bounds nested protobuf messages, with the root at depth zero.
	MaxDepth = resourcev2.MaxValueDepth
	// MaxNodes bounds raw message occurrences across one frame, including its root.
	MaxNodes = resourcev2.MaxValueNodes
	// MaxFields bounds raw field occurrences across all messages in one frame.
	MaxFields = resourcev2.MaxWireFields
	// MaxPageSize bounds page records and requested enumeration/query page sizes.
	MaxPageSize = resourcev2.MaxPageRecords
)

WirePolicy is an implementation-candidate transport ceiling, not predicate policy or an SLO.

Variables

This section is empty.

Functions

func IncomingSessionContext

func IncomingSessionContext(ctx context.Context) (context.Context, error)

IncomingSessionContext validates shared resource metadata for utility RPCs. A missing pin is permitted here; reference-bearing dispatch must require it.

func OutgoingSessionContext

func OutgoingSessionContext(ctx context.Context) (context.Context, error)

OutgoingSessionContext serializes explicit catalog admission and diagnostic context for resource-bearing utility RPCs. It never discovers a catalog.

func RegisterServer

func RegisterServer(s *grpc.Server, p resourcev2.Provider)

RegisterServer registers resource services without a settings provider.

func ResourceDomainError

func ResourceDomainError(err error) error

ResourceDomainError restores a classified resource error from a gRPC status.

func ResourceRPCError

func ResourceRPCError(err error) error

ResourceRPCError converts a domain error into a public-safe gRPC status.

func ResponseAdmission

func ResponseAdmission() (grpc.CallOption, func() error)

ResponseAdmission retains response admission failures within one unary call.

func ServerOptions

func ServerOptions() []grpc.ServerOption

ServerOptions bounds incoming and outgoing resource frames.

func ValidateLegacyExecWire

func ValidateLegacyExecWire(data []byte) error

ValidateLegacyExecWire detects resource intent without discarding reserved fields. Nonresource utility messages retain the generated protobuf admission policy.

func ValidateLegacyUtilityWire

func ValidateLegacyUtilityWire(data []byte, resourceFields, nonemptyFields []protowire.Number) error

ValidateLegacyUtilityWire checks only resource intent on an ordinary utility lane. It never materializes or converts a legacy Struct into canonical data.

func ValidateWire

func ValidateWire(data []byte, descriptor protoreflect.MessageDescriptor) error

ValidateWire admits only the exact negotiated resource descriptor tree, before decoding.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client adapts remote resource operations to domain interfaces. Its method set does not imply optional provider support; negotiate Features before using it.

func NewClient

func NewClient(c grpc.ClientConnInterface) *Client

NewClient binds resource operations to an existing gRPC connection.

func (*Client) Action

Action invokes a finite provider action under the accepted catalog observation.

func (*Client) ApplyConnectionOverlay

func (c *Client) ApplyConnectionOverlay(ctx context.Context, overlay resourcev2.ConnectionOverlay) error

ApplyConnectionOverlay replaces host intent; an empty overlay restores native discovery.

func (*Client) Catalog

Catalog discovers the provider's catalog for the explicit route.

func (*Client) CheckConnection

func (c *Client) CheckConnection(ctx context.Context, id string) (types.ConnectionStatus, error)

CheckConnection performs the provider's optional health check.

func (*Client) Close

func (c *Client) Close() error

Close retires remote provider resources within the transport close timeout.

func (*Client) DeleteConnection

func (c *Client) DeleteConnection(ctx context.Context, id string) error

DeleteConnection removes the configured connection identified by id.

func (*Client) EnsureResourceWatch

func (c *Client) EnsureResourceWatch(ctx context.Context, target resourcev2.ReadTarget) error

EnsureResourceWatch starts the target's advisory watch unless it already exists.

func (*Client) Enumerate

Enumerate acquires a bounded source page under the accepted catalog observation.

func (*Client) Features

func (c *Client) Features(ctx context.Context) (resourcev2.FeatureSet, error)

Features negotiates optional remote traits independently of Client's method set.

func (*Client) Get

Get reads an explicit representation and validates its admitted provenance.

func (*Client) GetActions

func (c *Client) GetActions(
	ctx context.Context,
	route resourcev2.AccessRoute,
	key string,
) ([]resourcev2.ActionDescriptor, error)

GetActions returns validated action descriptors for one resource type.

func (*Client) GetConnection

func (c *Client) GetConnection(ctx context.Context, id string) (types.Connection, error)

GetConnection returns one configured profile without starting it.

func (*Client) GetConnectionStatus

func (c *Client) GetConnectionStatus(ctx context.Context, id string) (types.ConnectionStatus, error)

GetConnectionStatus reports registered lifecycle state, never a health probe.

func (*Client) GetEditorSchemas

func (c *Client) GetEditorSchemas(
	ctx context.Context,
	route resourcev2.AccessRoute,
) ([]resourcev2.EditorSchema, error)

GetEditorSchemas returns editor schema bindings for the selected route.

func (*Client) GetHealth

GetHealth returns optional health for the resource body; nil health means no health result.

func (*Client) GetRelationships

func (c *Client) GetRelationships(
	ctx context.Context,
	route resourcev2.AccessRoute,
	key string,
) ([]resourcev2.RelationshipDescriptor, error)

GetRelationships returns relationship descriptors for one resource type.

func (*Client) GetResourceDefinition

func (c *Client) GetResourceDefinition(
	ctx context.Context,
	route resourcev2.AccessRoute,
	key string,
) (resourcev2.ResourceDefinition, error)

GetResourceDefinition returns the validated presentation definition for one resource type.

func (*Client) GetResourceEvents

func (c *Client) GetResourceEvents(
	ctx context.Context,
	in resourcev2.GetRequest,
	limit uint32,
) ([]resourcev2.ResourceEvent, error)

GetResourceEvents returns resource events within both the requested and transport limits.

func (*Client) GetResourceGroups

func (c *Client) GetResourceGroups(
	ctx context.Context,
	route resourcev2.AccessRoute,
) ([]resourcev2.ResourceGroup, error)

GetResourceGroups returns validated presentation groups for the selected route.

func (*Client) GetSchemaDocument

GetSchemaDocument fetches the exact schema document reference without substituting another revision.

func (*Client) GetWatchState

func (c *Client) GetWatchState(
	ctx context.Context,
	route resourcev2.AccessRoute,
) (*resourcev2.WatchConnectionSummary, error)

GetWatchState returns the route's current watch summary, or nil when no watch exists.

func (*Client) HasWatch

func (c *Client) HasWatch(ctx context.Context, route resourcev2.AccessRoute) bool

HasWatch has no error result in the domain contract; failures do not claim support or readiness.

func (*Client) IsResourceWatchRunning

func (c *Client) IsResourceWatchRunning(ctx context.Context, route resourcev2.AccessRoute, key string) (bool, error)

IsResourceWatchRunning reports whether the route and resource type have an active watch.

func (*Client) ListConnections

func (c *Client) ListConnections(ctx context.Context) ([]types.Connection, error)

ListConnections returns configured connection snapshots without starting native clients.

func (*Client) ListenForEvents

func (c *Client) ListenForEvents(ctx context.Context, sink resourcev2.WatchEventSink, onReady func() error) error

ListenForEvents delivers advisory updates after remote registration readiness. Cancellation ends the listener; onReady must succeed before any event is delivered.

func (*Client) LoadConnections

func (c *Client) LoadConnections(ctx context.Context) ([]types.Connection, error)

LoadConnections discovers configured profiles without starting native clients.

func (*Client) Mutate

Mutate admits the exact requested write verb and validates the returned record.

func (*Client) NativeConnections

func (c *Client) NativeConnections(ctx context.Context) ([]types.Connection, error)

NativeConnections returns source-owned profiles before host overlays apply.

func (*Client) NativeQuery

NativeQuery executes the provider's native query contract and validates its page.

func (*Client) ResolveRelationships

ResolveRelationships resolves links within the explicitly admitted source and target bindings.

func (*Client) RestartResourceWatch

func (c *Client) RestartResourceWatch(ctx context.Context, target resourcev2.ReadTarget) error

RestartResourceWatch replaces the target's advisory watch with a fresh source.

func (*Client) ScopeValues

func (c *Client) ScopeValues(ctx context.Context, route resourcev2.AccessRoute, dimension string) ([]string, error)

ScopeValues discovers values for one scope dimension on the explicit route.

func (*Client) StartConnection

func (c *Client) StartConnection(ctx context.Context, id string) (types.ConnectionStatus, error)

StartConnection starts the selected configured generation.

func (*Client) StartConnectionWatch

func (c *Client) StartConnectionWatch(ctx context.Context, targets []resourcev2.ReadTarget) error

StartConnectionWatch starts advisory watches for the explicit bounded target set.

func (*Client) StopConnection

func (c *Client) StopConnection(ctx context.Context, id string) (types.Connection, error)

StopConnection retires the selected generation and returns its profile.

func (*Client) StopConnectionWatch

func (c *Client) StopConnectionWatch(ctx context.Context, route resourcev2.AccessRoute) error

StopConnectionWatch stops advisory watches on the selected route.

func (*Client) StopResourceWatch

func (c *Client) StopResourceWatch(ctx context.Context, route resourcev2.AccessRoute, key string) error

StopResourceWatch stops the resource type's watch on the selected route.

func (*Client) StreamAction

func (c *Client) StreamAction(
	ctx context.Context,
	in resourcev2.ActionRequest,
	out chan<- resourcev2.ActionEvent,
) error

StreamAction forwards action events after exactly one native readiness event and leaves out open.

func (*Client) UpdateConnection

func (c *Client) UpdateConnection(ctx context.Context, in types.Connection) (types.Connection, error)

UpdateConnection updates one configured connection after validating its wire metadata.

func (*Client) WatchConnections

func (c *Client) WatchConnections(ctx context.Context, out chan<- []types.Connection) error

WatchConnections forwards connection snapshots until completion or cancellation without closing out.

type GRPCPlugin

type GRPCPlugin struct {
	goplugin.NetRPCUnsupportedPlugin

	Impl             resourcev2.Provider
	SettingsProvider pkgsettings.Provider
}

GRPCPlugin exposes a resource provider through HashiCorp's gRPC plugin transport.

func (*GRPCPlugin) GRPCClient

func (p *GRPCPlugin) GRPCClient(_ context.Context, _ *goplugin.GRPCBroker, c *grpc.ClientConn) (any, error)

GRPCClient constructs the remote resource provider client.

func (*GRPCPlugin) GRPCServer

func (p *GRPCPlugin) GRPCServer(_ *goplugin.GRPCBroker, s *grpc.Server) error

GRPCServer registers resource services with the plugin's gRPC server.

type TransportEnvelope

type TransportEnvelope = envelope

TransportEnvelope preserves admission errors before generated protobuf decoding.

func NewTransportEnvelope

func NewTransportEnvelope(message proto.Message, legacyExec bool) *TransportEnvelope

NewTransportEnvelope wraps a message for bounded raw-wire admission before decoding.

func NewUtilityTransportEnvelope

func NewUtilityTransportEnvelope(message proto.Message, legacyValidator func([]byte) error) *TransportEnvelope

NewUtilityTransportEnvelope admits a resource utility message before generated decoding. A nil legacyValidator selects the strict negotiated descriptor tree; a nonnil validator preserves an ordinary utility lane while rejecting resource intent or a legacy resource body before that lane can reach native code.

Jump to

Keyboard shortcuts

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