Documentation
¶
Overview ¶
Package plugin transports resource v2 providers over bounded, validated gRPC messages.
Index ¶
- Constants
- func IncomingSessionContext(ctx context.Context) (context.Context, error)
- func OutgoingSessionContext(ctx context.Context) (context.Context, error)
- func RegisterServer(s *grpc.Server, p resourcev2.Provider)
- func ResourceDomainError(err error) error
- func ResourceRPCError(err error) error
- func ResponseAdmission() (grpc.CallOption, func() error)
- func ServerOptions() []grpc.ServerOption
- func ValidateLegacyExecWire(data []byte) error
- func ValidateLegacyUtilityWire(data []byte, resourceFields, nonemptyFields []protowire.Number) error
- func ValidateWire(data []byte, descriptor protoreflect.MessageDescriptor) error
- type Client
- func (c *Client) Action(ctx context.Context, in resourcev2.ActionRequest) (resourcev2.Value, error)
- func (c *Client) ApplyConnectionOverlay(ctx context.Context, overlay resourcev2.ConnectionOverlay) error
- func (c *Client) Catalog(ctx context.Context, in resourcev2.CatalogRequest) (resourcev2.Catalog, error)
- func (c *Client) CheckConnection(ctx context.Context, id string) (types.ConnectionStatus, error)
- func (c *Client) Close() error
- func (c *Client) DeleteConnection(ctx context.Context, id string) error
- func (c *Client) EnsureResourceWatch(ctx context.Context, target resourcev2.ReadTarget) error
- func (c *Client) Enumerate(ctx context.Context, in resourcev2.EnumerateRequest) (resourcev2.SourcePage, error)
- func (c *Client) Features(ctx context.Context) (resourcev2.FeatureSet, error)
- func (c *Client) Get(ctx context.Context, in resourcev2.GetRequest) (resourcev2.Record, error)
- func (c *Client) GetActions(ctx context.Context, route resourcev2.AccessRoute, key string) ([]resourcev2.ActionDescriptor, error)
- func (c *Client) GetConnection(ctx context.Context, id string) (types.Connection, error)
- func (c *Client) GetConnectionMetadata(ctx context.Context, id string) (resourcev2.ConnectionMetadataSnapshot, error)
- func (c *Client) GetConnectionStatus(ctx context.Context, id string) (types.ConnectionStatus, error)
- func (c *Client) GetEditorSchemas(ctx context.Context, route resourcev2.AccessRoute) ([]resourcev2.EditorSchema, error)
- func (c *Client) GetHealth(ctx context.Context, in resourcev2.GetRequest, body resourcev2.Value) (*resourcev2.ResourceHealth, error)
- func (c *Client) GetRelationships(ctx context.Context, route resourcev2.AccessRoute, key string) ([]resourcev2.RelationshipDescriptor, error)
- func (c *Client) GetResourceDefinition(ctx context.Context, route resourcev2.AccessRoute, key string) (resourcev2.ResourceDefinition, error)
- func (c *Client) GetResourceEvents(ctx context.Context, in resourcev2.GetRequest, limit uint32) ([]resourcev2.ResourceEvent, error)
- func (c *Client) GetResourceGroups(ctx context.Context, route resourcev2.AccessRoute) ([]resourcev2.ResourceGroup, error)
- func (c *Client) GetSchemaDocument(ctx context.Context, route resourcev2.AccessRoute, ...) (resourcev2.SchemaDocument, error)
- func (c *Client) GetWatchState(ctx context.Context, route resourcev2.AccessRoute) (*resourcev2.WatchConnectionSummary, error)
- func (c *Client) HasWatch(ctx context.Context, route resourcev2.AccessRoute) bool
- func (c *Client) IsResourceWatchRunning(ctx context.Context, route resourcev2.AccessRoute, key string) (bool, error)
- func (c *Client) ListConnections(ctx context.Context) ([]types.Connection, error)
- func (c *Client) ListenForEvents(ctx context.Context, sink resourcev2.WatchEventSink, onReady func() error) error
- func (c *Client) LoadConnections(ctx context.Context) ([]types.Connection, error)
- func (c *Client) Mutate(ctx context.Context, in resourcev2.MutationRequest) (resourcev2.Record, error)
- func (c *Client) NativeConnections(ctx context.Context) ([]types.Connection, error)
- func (c *Client) NativeQuery(ctx context.Context, in resourcev2.NativeQueryRequest) (resourcev2.SourcePage, error)
- func (c *Client) RefreshConnectionMetadata(ctx context.Context, id string) (resourcev2.ConnectionMetadataSnapshot, error)
- func (c *Client) ResolveRelationships(ctx context.Context, in resourcev2.RelationshipResolutionRequest) ([]resourcev2.ResolvedRelationship, error)
- func (c *Client) RestartResourceWatch(ctx context.Context, target resourcev2.ReadTarget) error
- func (c *Client) ScopeValues(ctx context.Context, route resourcev2.AccessRoute, dimension string) ([]string, error)
- func (c *Client) StartConnection(ctx context.Context, id string) (types.ConnectionStatus, error)
- func (c *Client) StartConnectionWatch(ctx context.Context, targets []resourcev2.ReadTarget) error
- func (c *Client) StopConnection(ctx context.Context, id string) (types.Connection, error)
- func (c *Client) StopConnectionWatch(ctx context.Context, route resourcev2.AccessRoute) error
- func (c *Client) StopResourceWatch(ctx context.Context, route resourcev2.AccessRoute, key string) error
- func (c *Client) StreamAction(ctx context.Context, in resourcev2.ActionRequest, ...) error
- func (c *Client) UpdateConnection(ctx context.Context, in types.Connection) (types.Connection, error)
- func (c *Client) WatchConnectionMetadata(ctx context.Context, sink resourcev2.ConnectionMetadataSink) error
- func (c *Client) WatchConnections(ctx context.Context, out chan<- []types.Connection) error
- type GRPCPlugin
- type TransportEnvelope
Constants ¶
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.MaxProtoDepth // 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 )
const WirePolicy = resourcev2.ResourceWirePolicy
WirePolicy is an implementation-candidate transport ceiling, not predicate policy or an SLO.
Variables ¶
This section is empty.
Functions ¶
func IncomingSessionContext ¶
IncomingSessionContext validates shared resource metadata for utility RPCs. A missing pin is permitted here; reference-bearing dispatch must require it.
func OutgoingSessionContext ¶
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 ¶
ResourceDomainError restores a classified resource error from a gRPC status.
func ResourceRPCError ¶
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 ¶
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 ¶
func (c *Client) Action(ctx context.Context, in resourcev2.ActionRequest) (resourcev2.Value, error)
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 ¶
func (c *Client) Catalog(ctx context.Context, in resourcev2.CatalogRequest) (resourcev2.Catalog, error)
Catalog discovers the provider's catalog for the explicit route.
func (*Client) CheckConnection ¶
CheckConnection performs the provider's optional health check.
func (*Client) DeleteConnection ¶
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 ¶
func (c *Client) Enumerate(ctx context.Context, in resourcev2.EnumerateRequest) (resourcev2.SourcePage, error)
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 ¶
func (c *Client) Get(ctx context.Context, in resourcev2.GetRequest) (resourcev2.Record, error)
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 ¶
GetConnection returns one configured profile without starting it.
func (*Client) GetConnectionMetadata ¶ added in v0.10.0
func (c *Client) GetConnectionMetadata(ctx context.Context, id string) (resourcev2.ConnectionMetadataSnapshot, error)
GetConnectionMetadata returns the provider's cached metadata without refreshing 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 ¶
func (c *Client) GetHealth( ctx context.Context, in resourcev2.GetRequest, body resourcev2.Value, ) (*resourcev2.ResourceHealth, error)
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 ¶
func (c *Client) GetSchemaDocument( ctx context.Context, route resourcev2.AccessRoute, reference resourcev2.SchemaDocumentReference, ) (resourcev2.SchemaDocument, error)
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 ¶
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 ¶
LoadConnections discovers configured profiles without starting native clients.
func (*Client) Mutate ¶
func (c *Client) Mutate(ctx context.Context, in resourcev2.MutationRequest) (resourcev2.Record, error)
Mutate admits the exact requested write verb and validates the returned record.
func (*Client) NativeConnections ¶
NativeConnections returns source-owned profiles before host overlays apply.
func (*Client) NativeQuery ¶
func (c *Client) NativeQuery(ctx context.Context, in resourcev2.NativeQueryRequest) (resourcev2.SourcePage, error)
NativeQuery executes the provider's native query contract and validates its page.
func (*Client) RefreshConnectionMetadata ¶ added in v0.10.0
func (c *Client) RefreshConnectionMetadata(ctx context.Context, id string) (resourcev2.ConnectionMetadataSnapshot, error)
RefreshConnectionMetadata requests a refresh and returns the provider's current snapshot.
func (*Client) ResolveRelationships ¶
func (c *Client) ResolveRelationships( ctx context.Context, in resourcev2.RelationshipResolutionRequest, ) ([]resourcev2.ResolvedRelationship, error)
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 ¶
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 ¶
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) WatchConnectionMetadata ¶ added in v0.10.0
func (c *Client) WatchConnectionMetadata(ctx context.Context, sink resourcev2.ConnectionMetadataSink) error
WatchConnectionMetadata forwards snapshots and removals until completion or cancellation.
func (*Client) WatchConnections ¶
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.
Source Files
¶
- ancillary_client.go
- ancillary_connections.go
- ancillary_presentation.go
- ancillary_relationships.go
- ancillary_server.go
- ancillary_stream.go
- catalog_pin.go
- catalog_route_session.go
- client.go
- codec.go
- connection_metadata.go
- connection_overlay.go
- connections.go
- features.go
- server.go
- session.go
- transport.go
- updates.go
- updates_stream.go
- utility_transport.go
- wire.go