plugin

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DataSourcePluginName = "data_source"

DataSourcePluginName is the name that should be used in the plugin map.

Variables

View Source
var DataSourcePluginArgs []string = []string{"data-source", "serve"}

DataSourcePluginArgs contains the arguments passed to plugins when executing them as a data source.

View Source
var HandshakeConfig = go_plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "COFIDECTL_PLUGIN",
	MagicCookieValue: "config",
}

HandshakeConfig is a common handshake that is shared by plugin and host.

Functions

func GetPluginDir

func GetPluginDir() (string, error)

func GetPluginPath

func GetPluginPath(name string) (string, error)

func IsDataSourceServeCmd

func IsDataSourceServeCmd(args []string) bool

IsDataSourceServeCmd returns whether the provided command line arguments indicate that a plugin should serve a data source.

func PluginExists

func PluginExists(name string) (bool, error)

Types

type CliPlugin

type CliPlugin struct {
	BinaryName string
	Args       []string
}

func NewCliPlugin

func NewCliPlugin(binary string, args []string) *CliPlugin

func (*CliPlugin) Execute

func (cp *CliPlugin) Execute() error

Execute executes a CLI plugin by exec'ing into it, replacing the current process. This may change to execute the plugin as a subprocess, but Exec keeps things simple for now (no signal handling etc.)

type DataSource

type DataSource interface {
	Validate() error
	GetTrustZone(string) (*trust_zone_proto.TrustZone, error)
	ListTrustZones() ([]*trust_zone_proto.TrustZone, error)
	AddTrustZone(*trust_zone_proto.TrustZone) (*trust_zone_proto.TrustZone, error)
	UpdateTrustZone(*trust_zone_proto.TrustZone) error

	AddAttestationPolicy(*attestation_policy_proto.AttestationPolicy) (*attestation_policy_proto.AttestationPolicy, error)
	GetAttestationPolicy(string) (*attestation_policy_proto.AttestationPolicy, error)
	ListAttestationPolicies() ([]*attestation_policy_proto.AttestationPolicy, error)

	AddAPBinding(*ap_binding_proto.APBinding) (*ap_binding_proto.APBinding, error)
	DestroyAPBinding(*ap_binding_proto.APBinding) error

	AddFederation(*federation_proto.Federation) (*federation_proto.Federation, error)
	ListFederations() ([]*federation_proto.Federation, error)
	ListFederationsByTrustZone(string) ([]*federation_proto.Federation, error)
}

DataSource is the interface plugins have to implement.

type DataSourcePlugin

type DataSourcePlugin struct {
	go_plugin.Plugin
	Impl DataSource
}

DataSourcePlugin implements the plugin.Plugin interface to provide the GRPC server or client back to the plugin machinery. The server side should proved the Impl field with a concrete implementation of the DataSource interface.

func (*DataSourcePlugin) GRPCClient

func (dsp *DataSourcePlugin) GRPCClient(ctx context.Context, broker *go_plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*DataSourcePlugin) GRPCServer

func (dsp *DataSourcePlugin) GRPCServer(broker *go_plugin.GRPCBroker, s *grpc.Server) error

type DataSourcePluginClientGRPC

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

DataSourcePluginClientGRPC is used by clients (main application) to translate the DataSource interface of plugins to GRPC calls.

func (*DataSourcePluginClientGRPC) AddAPBinding

func (*DataSourcePluginClientGRPC) AddFederation

func (*DataSourcePluginClientGRPC) AddTrustZone

func (*DataSourcePluginClientGRPC) DestroyAPBinding

func (*DataSourcePluginClientGRPC) GetAttestationPolicy

func (*DataSourcePluginClientGRPC) GetTrustZone

func (*DataSourcePluginClientGRPC) ListAttestationPolicies

func (*DataSourcePluginClientGRPC) ListFederations

func (c *DataSourcePluginClientGRPC) ListFederations() ([]*federation_proto.Federation, error)

func (*DataSourcePluginClientGRPC) ListFederationsByTrustZone

func (c *DataSourcePluginClientGRPC) ListFederationsByTrustZone(string) ([]*federation_proto.Federation, error)

func (*DataSourcePluginClientGRPC) ListTrustZones

func (c *DataSourcePluginClientGRPC) ListTrustZones() ([]*trust_zone_proto.TrustZone, error)

func (*DataSourcePluginClientGRPC) UpdateTrustZone

func (*DataSourcePluginClientGRPC) Validate

func (c *DataSourcePluginClientGRPC) Validate() error

type GRPCServer

type GRPCServer struct {
	Impl DataSource
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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