{"modulePath":"github.com/omniviewdev/plugin-sdk","version":"v0.25.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package plugin\n\nPackage plugin transports resource v2 providers over bounded, validated gRPC messages.\n\n## Constants\n\n```go\nconst (\n\t// MaxWireBytes bounds the entire raw resource protobuf frame before decoding.\n\tMaxWireBytes = resourcev2.MaxMessageBytes\n\t// MaxBodyBytes bounds scalar payloads and encoded resource Value documents.\n\tMaxBodyBytes = resourcev2.MaxDocumentBytes\n\t// MaxDepth bounds nested protobuf messages, with the root at depth zero.\n\tMaxDepth = resourcev2.MaxProtoDepth\n\t// MaxNodes bounds raw message occurrences across one frame, including its root.\n\tMaxNodes = resourcev2.MaxValueNodes\n\t// MaxFields bounds raw field occurrences across all messages in one frame.\n\tMaxFields = resourcev2.MaxWireFields\n\t// MaxPageSize bounds page records and requested enumeration/query page sizes.\n\tMaxPageSize = resourcev2.MaxPageRecords\n)\n```\n\n```go\nconst MaxErrorMessageBytes = 2048\n```\nMaxErrorMessageBytes bounds the sentence a classified error carries across the resource transport. Text that is longer, or not valid UTF-8, is not carried: the receiver gets the classification and no sentence.\n\n```go\nconst WirePolicy = resourcev2.ResourceWirePolicy\n```\nWirePolicy is an implementation-candidate transport ceiling, not predicate policy or an SLO.\n\n## Functions\n\n```go\nfunc CredentialFailureFromError(err error, trailer metadata.MD) (*credentialpb.CredentialFailure, bool)\n```\nCredentialFailureFromError admits the error and original trailer from the same completed credential RPC. Capture grpc.Trailer(\u0026md) for a unary call, or use stream.Trailer() after the terminal Recv. An error alone has lost wire information. False leaves callers only the gRPC class. Never display peer text or treat a suggestion as a grant. The channel must separately bound HTTP/2 header lists.\n\n```go\nfunc CredentialRPCError(failure *credentialpb.CredentialFailure) error\n```\nCredentialRPCError encodes a credential service failure with a fixed message and exactly two classified details. An invalid local failure yields Internal without details. Return cancellation, deadlines and unrelated errors on their own paths.\n\n```go\nfunc IncomingSessionContext(ctx context.Context) (context.Context, error)\n```\nIncomingSessionContext validates shared resource metadata for utility RPCs. A missing pin is permitted here; reference-bearing dispatch must require it.\n\n```go\nfunc IsFatalSourceTransportError(err error) bool\n```\nIsFatalSourceTransportError reports a connection-level physical framing failure. The host must retire the affected provider transport rather than treat it as an ordinary per-RPC source reset.\n\n```go\nfunc OutgoingSessionContext(ctx context.Context) (context.Context, error)\n```\nOutgoingSessionContext serializes explicit catalog admission and diagnostic context for resource-bearing utility RPCs. It never discovers a catalog.\n\n```go\nfunc RegisterServer(s *grpc.Server, p resourcev2.Provider)\n```\nRegisterServer registers resource services without a settings provider.\n\n```go\nfunc ResourceDomainError(err error) error\n```\nResourceDomainError restores a classified resource error from a gRPC status. When the status carries the provider's sentence (a bounded English LocalizedMessage beside the classification) it is the error's Message; otherwise Message is empty. Title and Suggestions are never restored. The error keeps the status in Err.\n\n```go\nfunc ResourceRPCError(err error) error\n```\nResourceRPCError converts a domain error into a public-safe gRPC status that carries the classification only. It is the encoder the sibling services share (resource exec, host connections), and none of them has ever put a sentence on the wire: the resource provider server, which does, carries it by itself.\n\n```go\nfunc ResponseAdmission() (grpc.CallOption, func() error)\n```\nResponseAdmission retains response admission failures within one unary call.\n\n```go\nfunc ServerOptions() []grpc.ServerOption\n```\nServerOptions bounds incoming and outgoing resource frames.\n\n```go\nfunc ValidateLegacyExecWire(data []byte) error\n```\nValidateLegacyExecWire detects resource intent without discarding reserved fields. Nonresource utility messages retain the generated protobuf admission policy.\n\n```go\nfunc ValidateLegacyUtilityWire(data []byte, resourceFields, nonemptyFields []protowire.Number) error\n```\nValidateLegacyUtilityWire checks only resource intent on an ordinary utility lane. It never materializes or converts a legacy Struct into canonical data.\n\n```go\nfunc ValidateWire(data []byte, descriptor protoreflect.MessageDescriptor) error\n```\nValidateWire admits a strict SDK descriptor tree before generated protobuf decoding.\n\n```go\nfunc WithSourceSnapshotProgressTimeout(ctx context.Context, timeout time.Duration) (context.Context, error)\n```\nWithSourceSnapshotProgressTimeout configures the idle progress deadline for snapshot acquisition. It does not limit following or connection acquisition.\n\n## Types\n\n```go\ntype Client struct {\n\t// contains filtered or unexported fields\n}\n```\nClient adapts remote resource operations to domain interfaces. Its method set does not imply optional provider support; negotiate Features before using it.\n\n```go\nfunc NewClient(c grpc.ClientConnInterface) *Client\n```\nNewClient binds resource operations to an existing gRPC connection.\n\n```go\nfunc (c *Client) Action(ctx context.Context, in resourcev2.ActionRequest) (resourcev2.Value, error)\n```\nAction invokes a finite provider action under the accepted catalog observation.\n\n```go\nfunc (c *Client) ApplyConnectionOverlay(ctx context.Context, overlay resourcev2.ConnectionOverlay) error\n```\nApplyConnectionOverlay replaces host intent; an empty overlay restores native discovery.\n\n```go\nfunc (c *Client) Catalog(ctx context.Context, in resourcev2.CatalogRequest) (resourcev2.Catalog, error)\n```\nCatalog discovers the provider's catalog for the explicit route.\n\n```go\nfunc (c *Client) CheckConnection(ctx context.Context, id string) (types.ConnectionStatus, error)\n```\nCheckConnection performs the provider's optional health check.\n\n```go\nfunc (c *Client) Close() error\n```\nClose retires remote provider resources within the transport close timeout.\n\n```go\nfunc (c *Client) DeleteConnection(ctx context.Context, id string) error\n```\nDeleteConnection removes the configured connection identified by id.\n\n```go\nfunc (c *Client) Enumerate(ctx context.Context, in resourcev2.EnumerateRequest) (resourcev2.SourcePage, error)\n```\nEnumerate acquires a bounded source page under the accepted catalog observation.\n\n```go\nfunc (c *Client) Features(ctx context.Context) (resourcev2.FeatureSet, error)\n```\nFeatures negotiates optional remote traits independently of Client's method set.\n\n```go\nfunc (c *Client) Get(ctx context.Context, in resourcev2.GetRequest) (resourcev2.Record, error)\n```\nGet reads an explicit representation and validates its admitted provenance.\n\n```go\nfunc (c *Client) GetActions(\n\tctx context.Context,\n\troute resourcev2.AccessRoute,\n\tkey string,\n) ([]resourcev2.ActionDescriptor, error)\n```\nGetActions returns validated action descriptors for one resource type.\n\n```go\nfunc (c *Client) GetConnection(ctx context.Context, id string) (types.Connection, error)\n```\nGetConnection returns one configured profile without starting it.\n\n```go\nfunc (c *Client) GetConnectionMetadata(ctx context.Context, id string) (resourcev2.ConnectionMetadataSnapshot, error)\n```\nGetConnectionMetadata returns the provider's cached metadata without refreshing it.\n\n```go\nfunc (c *Client) GetConnectionStatus(ctx context.Context, id string) (types.ConnectionStatus, error)\n```\nGetConnectionStatus reports registered lifecycle state, never a health probe.\n\n```go\nfunc (c *Client) GetHealth(\n\tctx context.Context,\n\tin resourcev2.GetRequest,\n\tbody resourcev2.Value,\n) (*resourcev2.ResourceHealth, error)\n```\nGetHealth returns optional health for the resource body; nil health means no health result.\n\n```go\nfunc (c *Client) GetRelationships(\n\tctx context.Context,\n\troute resourcev2.AccessRoute,\n\tkey string,\n) ([]resourcev2.RelationshipDescriptor, error)\n```\nGetRelationships returns relationship descriptors for one resource type.\n\n```go\nfunc (c *Client) GetResourceDefinition(\n\tctx context.Context,\n\troute resourcev2.AccessRoute,\n\tkey string,\n) (resourcev2.ResourceDefinition, error)\n```\nGetResourceDefinition returns the validated presentation definition for one resource type.\n\n```go\nfunc (c *Client) GetResourceEvents(\n\tctx context.Context,\n\tin resourcev2.GetRequest,\n\tlimit uint32,\n) ([]resourcev2.ResourceEvent, error)\n```\nGetResourceEvents returns resource events within both the requested and transport limits.\n\n```go\nfunc (c *Client) GetResourceGroups(\n\tctx context.Context,\n\troute resourcev2.AccessRoute,\n) ([]resourcev2.ResourceGroup, error)\n```\nGetResourceGroups returns validated presentation groups for the selected route.\n\n```go\nfunc (c *Client) GetSchemaDocument(\n\tctx context.Context,\n\troute resourcev2.AccessRoute,\n\treference resourcev2.SchemaDocumentReference,\n) (resourcev2.SchemaDocument, error)\n```\nGetSchemaDocument fetches the exact schema document reference without substituting another revision.\n\n```go\nfunc (c *Client) ListConnections(ctx context.Context) ([]types.Connection, error)\n```\nListConnections returns configured connection snapshots without starting native clients.\n\n```go\nfunc (c *Client) LoadConnections(ctx context.Context) ([]types.Connection, error)\n```\nLoadConnections discovers configured profiles without starting native clients.\n\n```go\nfunc (c *Client) Mutate(ctx context.Context, in resourcev2.MutationRequest) (resourcev2.Record, error)\n```\nMutate admits the exact requested write verb and validates the returned record.\n\n```go\nfunc (c *Client) NativeConnections(ctx context.Context) ([]types.Connection, error)\n```\nNativeConnections returns source-owned profiles before host overlays apply.\n\n```go\nfunc (c *Client) NativeQuery(ctx context.Context, in resourcev2.NativeQueryRequest) (resourcev2.SourcePage, error)\n```\nNativeQuery executes the provider's native query contract and validates its page.\n\n```go\nfunc (c *Client) OpenSourceStream(ctx context.Context, r resourcev2.SourceOpenRequest) (resourcev2.SourceStream, error)\n```\nOpenSourceStream opens a bounded, validated source session.\n\n```go\nfunc (c *Client) RefreshConnectionMetadata(ctx context.Context, id string) (resourcev2.ConnectionMetadataSnapshot, error)\n```\nRefreshConnectionMetadata requests a refresh and returns the provider's current snapshot.\n\n```go\nfunc (c *Client) ResolveRelationships(\n\tctx context.Context,\n\tin resourcev2.RelationshipResolutionRequest,\n) ([]resourcev2.ResolvedRelationship, error)\n```\nResolveRelationships resolves links within the explicitly admitted source and target bindings.\n\n```go\nfunc (c *Client) ResolveSchema(\n\tctx context.Context,\n\tin resourcev2.SchemaRequest,\n) (resourcev2.SchemaBinding, error)\n```\nResolveSchema resolves one explicit target only when its optional trait is advertised.\n\n```go\nfunc (c *Client) ScopeValues(ctx context.Context, route resourcev2.AccessRoute, dimension string) ([]string, error)\n```\nScopeValues discovers values for one scope dimension on the explicit route.\n\n```go\nfunc (c *Client) StartConnection(ctx context.Context, id string) (types.ConnectionStatus, error)\n```\nStartConnection starts the selected configured generation.\n\n```go\nfunc (c *Client) StopConnection(ctx context.Context, id string) (types.Connection, error)\n```\nStopConnection retires the selected generation and returns its profile.\n\n```go\nfunc (c *Client) StreamAction(\n\tctx context.Context,\n\tin resourcev2.ActionRequest,\n\tout chan\u003c- resourcev2.ActionEvent,\n) (result error)\n```\nStreamAction forwards action events after exactly one native readiness event and leaves out open.\n\n```go\nfunc (c *Client) UpdateConnection(ctx context.Context, in types.Connection) (types.Connection, error)\n```\nUpdateConnection updates one configured connection after validating its wire metadata.\n\n```go\nfunc (c *Client) WatchConnectionMetadata(ctx context.Context, sink resourcev2.ConnectionMetadataSink) error\n```\nWatchConnectionMetadata forwards snapshots and removals until completion or cancellation.\n\n```go\nfunc (c *Client) WatchConnections(ctx context.Context, out chan\u003c- []types.Connection) error\n```\nWatchConnections forwards connection snapshots until completion or cancellation without closing out.\n\n```go\ntype GRPCPlugin struct {\n\tgoplugin.NetRPCUnsupportedPlugin\n\n\tImpl             resourcev2.Provider\n\tSettingsProvider pkgsettings.Provider\n\t// OwnerID is the installed identity, not the canonical resource provider.\n\t// Without it the optional extension service is not registered.\n\tOwnerID string\n}\n```\nGRPCPlugin exposes a resource provider through HashiCorp's gRPC plugin transport.\n\n```go\nfunc (p *GRPCPlugin) GRPCClient(_ context.Context, _ *goplugin.GRPCBroker, c *grpc.ClientConn) (any, error)\n```\nGRPCClient constructs the remote resource provider client.\n\n```go\nfunc (p *GRPCPlugin) GRPCServer(_ *goplugin.GRPCBroker, s *grpc.Server) error\n```\nGRPCServer registers resource services with the plugin's gRPC server.\n\n```go\ntype TransportEnvelope = envelope\n```\nTransportEnvelope preserves admission errors before generated protobuf decoding.\n\n```go\nfunc NewTransportEnvelope(message proto.Message, legacyExec bool) *TransportEnvelope\n```\nNewTransportEnvelope wraps a message for bounded raw-wire admission before decoding.\n\n```go\nfunc NewUtilityTransportEnvelope(message proto.Message, legacyValidator func([]byte) error) *TransportEnvelope\n```\nNewUtilityTransportEnvelope 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.\n\n","path":"github.com/omniviewdev/plugin-sdk/pkg/resource/v2/plugin","name":"plugin","synopsis":"Package plugin transports resource v2 providers over bounded, validated gRPC messages.","isRedistributable":true}
