server

package
v0.0.0-...-bd3f3ed Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RPCPlugin

type RPCPlugin struct {
	RPCPlugin func() (schema.Plugin, error)
}

RPCPlugin is an implementation of the github.com/hashicorp/go-plugin#Plugin interface indicating how to serve a Shell Plugin over RPC using go-plugin.

func (*RPCPlugin) Client

func (p *RPCPlugin) Client(*plugin.MuxBroker, *rpc.Client) (any, error)

Client always returns an error; we're only implementing a server.

func (*RPCPlugin) Server

func (p *RPCPlugin) Server(*plugin.MuxBroker) (any, error)

Server registers the RPC provider server with the RPC server that go-plugin is setting up.

type RPCServer

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

RPCServer makes a schema.Plugin available over RPC. Any method on this struct is available to a client over RPC.

The schema.Plugin struct has various slices that contain functions or interfaces that should also be available over RPC. Since Go's rpc package does not support storing functions in structs, these functions and interfaces are removed from the schema.Plugin and stored in a map. These functions can then be called by making a separate RPC call that includes the address in this map.

func (*RPCServer) CredentialImport

func (t *RPCServer) CredentialImport(req proto.ImportCredentialRequest, resp *sdk.ImportOutput) error

CredentialImport is a remote version of the Import() function in schema.CredentialType. The call is forwarded to the Import() function of the credential identified by req.CredentialID.

func (*RPCServer) CredentialProvisionerDeprovision

func (t *RPCServer) CredentialProvisionerDeprovision(req proto.DeprovisionCredentialRequest, resp *sdk.DeprovisionOutput) error

CredentialProvisionerDeprovision is a remote version of the the Deprovision() method of the sdk.Provisioner interface. The call is forwarded to the Deprovision() function of the Provisioner of the credential identified by req.CredentialID.

func (*RPCServer) CredentialProvisionerDescription

func (t *RPCServer) CredentialProvisionerDescription(req proto.ProvisionerID, resp *string) error

CredentialProvisionerDescription is a remote version of the the Description() method of the sdk.Provisioner interface. The call is forwarded to the Description() function of the Provisioner of the credential identified by req.CredentialID.

func (*RPCServer) CredentialProvisionerProvision

func (t *RPCServer) CredentialProvisionerProvision(req proto.ProvisionCredentialRequest, resp *sdk.ProvisionOutput) error

CredentialProvisionerProvision is a remote version of the the Provision() method of the sdk.Provisioner interface. The call is forwarded to the Provision() function of the Provisioner of the credential identified by req.CredentialID.

func (*RPCServer) ExecutableNeedsAuth

func (t *RPCServer) ExecutableNeedsAuth(req proto.ExecutableNeedsAuthRequest, resp *bool) error

ExecutableNeedsAuth is a remote version of the NeedsAuth function in schema.Executable. The call is forwarded to Executables[req.ExecutableID].NeedsAuth of the original plugin.

func (*RPCServer) GetPlugin

func (t *RPCServer) GetPlugin(_ int, resp *proto.GetPluginResponse) error

GetPlugin returns the schema.Plugin for this RPCServer. All functions and interfaces in this plugin are set to nil. The caller of this function is responsible for replacing those values with an implementation that calls these functions over RPC.

Jump to

Keyboard shortcuts

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