Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterPluginServer(s grpc.ServiceRegistrar, srv PluginServer)
- type AnswerRequest
- func (*AnswerRequest) Descriptor() ([]byte, []int)deprecated
- func (x *AnswerRequest) GetRequestJson() []byte
- func (x *AnswerRequest) GetSecrets() map[string]string
- func (x *AnswerRequest) GetValuesJson() []byte
- func (*AnswerRequest) ProtoMessage()
- func (x *AnswerRequest) ProtoReflect() protoreflect.Message
- func (x *AnswerRequest) Reset()
- func (x *AnswerRequest) String() string
- type AnswerResponse
- type Caller
- func (*Caller) Descriptor() ([]byte, []int)deprecated
- func (x *Caller) GetAdminEmail() string
- func (x *Caller) GetDriverName() string
- func (x *Caller) GetDriverSlug() string
- func (x *Caller) GetRemote() string
- func (*Caller) ProtoMessage()
- func (x *Caller) ProtoReflect() protoreflect.Message
- func (x *Caller) Reset()
- func (x *Caller) String() string
- type HeaderValues
- type NotifyRequest
- func (*NotifyRequest) Descriptor() ([]byte, []int)deprecated
- func (x *NotifyRequest) GetEventJson() []byte
- func (x *NotifyRequest) GetSecrets() map[string]string
- func (x *NotifyRequest) GetValuesJson() []byte
- func (*NotifyRequest) ProtoMessage()
- func (x *NotifyRequest) ProtoReflect() protoreflect.Message
- func (x *NotifyRequest) Reset()
- func (x *NotifyRequest) String() string
- type NotifyResponse
- type PluginClient
- type PluginServer
- type ServeRequest
- func (*ServeRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ServeRequest) GetBaseUrl() string
- func (x *ServeRequest) GetBody() []byte
- func (x *ServeRequest) GetCaller() *Caller
- func (x *ServeRequest) GetHeaders() map[string]*HeaderValues
- func (x *ServeRequest) GetMethod() string
- func (x *ServeRequest) GetPath() string
- func (x *ServeRequest) GetPrefix() string
- func (x *ServeRequest) GetQuery() string
- func (x *ServeRequest) GetSecrets() map[string]string
- func (x *ServeRequest) GetValuesJson() []byte
- func (*ServeRequest) ProtoMessage()
- func (x *ServeRequest) ProtoReflect() protoreflect.Message
- func (x *ServeRequest) Reset()
- func (x *ServeRequest) String() string
- type ServeResponse
- func (*ServeResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ServeResponse) GetBody() []byte
- func (x *ServeResponse) GetHeaders() map[string]*HeaderValues
- func (x *ServeResponse) GetSignIn() string
- func (x *ServeResponse) GetSignOut() bool
- func (x *ServeResponse) GetStatus() uint32
- func (x *ServeResponse) GetUsageJson() []byte
- func (*ServeResponse) ProtoMessage()
- func (x *ServeResponse) ProtoReflect() protoreflect.Message
- func (x *ServeResponse) Reset()
- func (x *ServeResponse) String() string
- type SettingsRequest
- type SettingsResponse
- type UnimplementedPluginServer
- func (UnimplementedPluginServer) Answer(context.Context, *AnswerRequest) (*AnswerResponse, error)
- func (UnimplementedPluginServer) Notify(context.Context, *NotifyRequest) (*NotifyResponse, error)
- func (UnimplementedPluginServer) Serve(context.Context, *ServeRequest) (*ServeResponse, error)
- func (UnimplementedPluginServer) Settings(context.Context, *SettingsRequest) (*SettingsResponse, error)
- type UnsafePluginServer
Constants ¶
const ( Plugin_Settings_FullMethodName = "/pacenote.plugin.v1.Plugin/Settings" Plugin_Notify_FullMethodName = "/pacenote.plugin.v1.Plugin/Notify" Plugin_Answer_FullMethodName = "/pacenote.plugin.v1.Plugin/Answer" Plugin_Serve_FullMethodName = "/pacenote.plugin.v1.Plugin/Serve" )
Variables ¶
var File_plugin_proto protoreflect.FileDescriptor
var Plugin_ServiceDesc = grpc.ServiceDesc{ ServiceName: "pacenote.plugin.v1.Plugin", HandlerType: (*PluginServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Settings", Handler: _Plugin_Settings_Handler, }, { MethodName: "Notify", Handler: _Plugin_Notify_Handler, }, { MethodName: "Answer", Handler: _Plugin_Answer_Handler, }, { MethodName: "Serve", Handler: _Plugin_Serve_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "plugin.proto", }
Plugin_ServiceDesc is the grpc.ServiceDesc for Plugin service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterPluginServer ¶
func RegisterPluginServer(s grpc.ServiceRegistrar, srv PluginServer)
Types ¶
type AnswerRequest ¶
type AnswerRequest struct {
RequestJson []byte `protobuf:"bytes,1,opt,name=request_json,json=requestJson,proto3" json:"request_json,omitempty"`
ValuesJson []byte `protobuf:"bytes,2,opt,name=values_json,json=valuesJson,proto3" json:"values_json,omitempty"`
Secrets map[string]string `` /* 141-byte string literal not displayed */
// contains filtered or unexported fields
}
AnswerRequest carries a JSON Request, the settings and the secrets, on the same terms as NotifyRequest.
func (*AnswerRequest) Descriptor
deprecated
func (*AnswerRequest) Descriptor() ([]byte, []int)
Deprecated: Use AnswerRequest.ProtoReflect.Descriptor instead.
func (*AnswerRequest) GetRequestJson ¶
func (x *AnswerRequest) GetRequestJson() []byte
func (*AnswerRequest) GetSecrets ¶
func (x *AnswerRequest) GetSecrets() map[string]string
func (*AnswerRequest) GetValuesJson ¶
func (x *AnswerRequest) GetValuesJson() []byte
func (*AnswerRequest) ProtoMessage ¶
func (*AnswerRequest) ProtoMessage()
func (*AnswerRequest) ProtoReflect ¶
func (x *AnswerRequest) ProtoReflect() protoreflect.Message
func (*AnswerRequest) Reset ¶
func (x *AnswerRequest) Reset()
func (*AnswerRequest) String ¶
func (x *AnswerRequest) String() string
type AnswerResponse ¶
type AnswerResponse struct {
ResponseJson []byte `protobuf:"bytes,1,opt,name=response_json,json=responseJson,proto3" json:"response_json,omitempty"`
// contains filtered or unexported fields
}
AnswerResponse carries a JSON Response, which includes the Usage the call cost. A plugin that answers without reporting what it spent is reporting zero, and the operator's cap will believe it.
func (*AnswerResponse) Descriptor
deprecated
func (*AnswerResponse) Descriptor() ([]byte, []int)
Deprecated: Use AnswerResponse.ProtoReflect.Descriptor instead.
func (*AnswerResponse) GetResponseJson ¶
func (x *AnswerResponse) GetResponseJson() []byte
func (*AnswerResponse) ProtoMessage ¶
func (*AnswerResponse) ProtoMessage()
func (*AnswerResponse) ProtoReflect ¶
func (x *AnswerResponse) ProtoReflect() protoreflect.Message
func (*AnswerResponse) Reset ¶
func (x *AnswerResponse) Reset()
func (*AnswerResponse) String ¶
func (x *AnswerResponse) String() string
type Caller ¶
type Caller struct {
// driver_slug is the signed-in driver, or empty for nobody. It is set only
// where the host holds a driver session, which is the host's to mint.
DriverSlug string `protobuf:"bytes,1,opt,name=driver_slug,json=driverSlug,proto3" json:"driver_slug,omitempty"`
// driver_name is that driver's name, so a plugin need not look it up to say
// hello.
DriverName string `protobuf:"bytes,2,opt,name=driver_name,json=driverName,proto3" json:"driver_name,omitempty"`
// admin_email is the signed-in operator, or empty. A plugin serving an
// operator-only page is told who is reading it.
AdminEmail string `protobuf:"bytes,3,opt,name=admin_email,json=adminEmail,proto3" json:"admin_email,omitempty"`
// remote is the address the request came from, as the host resolved it
// behind whatever proxy the operator runs.
Remote string `protobuf:"bytes,4,opt,name=remote,proto3" json:"remote,omitempty"`
// contains filtered or unexported fields
}
Caller is who the host believes made the request. Every field is the host's word, not the caller's: none of it is read from a header a client can set.
func (*Caller) Descriptor
deprecated
func (*Caller) GetAdminEmail ¶
func (*Caller) GetDriverName ¶
func (*Caller) GetDriverSlug ¶
func (*Caller) ProtoMessage ¶
func (*Caller) ProtoMessage()
func (*Caller) ProtoReflect ¶
func (x *Caller) ProtoReflect() protoreflect.Message
type HeaderValues ¶
type HeaderValues struct {
Values []string `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
// contains filtered or unexported fields
}
HeaderValues is one header's values, because protobuf maps cannot hold a repeated field directly.
func (*HeaderValues) Descriptor
deprecated
func (*HeaderValues) Descriptor() ([]byte, []int)
Deprecated: Use HeaderValues.ProtoReflect.Descriptor instead.
func (*HeaderValues) GetValues ¶
func (x *HeaderValues) GetValues() []string
func (*HeaderValues) ProtoMessage ¶
func (*HeaderValues) ProtoMessage()
func (*HeaderValues) ProtoReflect ¶
func (x *HeaderValues) ProtoReflect() protoreflect.Message
func (*HeaderValues) Reset ¶
func (x *HeaderValues) Reset()
func (*HeaderValues) String ¶
func (x *HeaderValues) String() string
type NotifyRequest ¶
type NotifyRequest struct {
EventJson []byte `protobuf:"bytes,1,opt,name=event_json,json=eventJson,proto3" json:"event_json,omitempty"`
ValuesJson []byte `protobuf:"bytes,2,opt,name=values_json,json=valuesJson,proto3" json:"values_json,omitempty"`
// secrets maps a declared setting name to the credential the core holds for
// it. Present only for the settings this plugin itself declared as secret:
// no plugin ever receives another plugin's.
Secrets map[string]string `` /* 141-byte string literal not displayed */
// contains filtered or unexported fields
}
NotifyRequest carries a JSON Event, the operator's settings for this plugin, and the credentials this plugin declared.
func (*NotifyRequest) Descriptor
deprecated
func (*NotifyRequest) Descriptor() ([]byte, []int)
Deprecated: Use NotifyRequest.ProtoReflect.Descriptor instead.
func (*NotifyRequest) GetEventJson ¶
func (x *NotifyRequest) GetEventJson() []byte
func (*NotifyRequest) GetSecrets ¶
func (x *NotifyRequest) GetSecrets() map[string]string
func (*NotifyRequest) GetValuesJson ¶
func (x *NotifyRequest) GetValuesJson() []byte
func (*NotifyRequest) ProtoMessage ¶
func (*NotifyRequest) ProtoMessage()
func (*NotifyRequest) ProtoReflect ¶
func (x *NotifyRequest) ProtoReflect() protoreflect.Message
func (*NotifyRequest) Reset ¶
func (x *NotifyRequest) Reset()
func (*NotifyRequest) String ¶
func (x *NotifyRequest) String() string
type NotifyResponse ¶
type NotifyResponse struct {
UsageJson []byte `protobuf:"bytes,1,opt,name=usage_json,json=usageJson,proto3" json:"usage_json,omitempty"`
// contains filtered or unexported fields
}
NotifyResponse carries a JSON Usage: what the event cost, if anything.
func (*NotifyResponse) Descriptor
deprecated
func (*NotifyResponse) Descriptor() ([]byte, []int)
Deprecated: Use NotifyResponse.ProtoReflect.Descriptor instead.
func (*NotifyResponse) GetUsageJson ¶
func (x *NotifyResponse) GetUsageJson() []byte
func (*NotifyResponse) ProtoMessage ¶
func (*NotifyResponse) ProtoMessage()
func (*NotifyResponse) ProtoReflect ¶
func (x *NotifyResponse) ProtoReflect() protoreflect.Message
func (*NotifyResponse) Reset ¶
func (x *NotifyResponse) Reset()
func (*NotifyResponse) String ¶
func (x *NotifyResponse) String() string
type PluginClient ¶
type PluginClient interface {
// Settings declares what the operator has to fill in. The host asks once,
// when the plugin starts, and stores the answer so the panel can render the
// form whether or not the plugin is running.
Settings(ctx context.Context, in *SettingsRequest, opts ...grpc.CallOption) (*SettingsResponse, error)
// Notify tells the plugin something happened. The host does not wait for the
// answer before carrying on with its own work, but the answer still carries
// what the call spent, because a plugin that burns the operator's tokens on
// an event must be metered like any other call.
Notify(ctx context.Context, in *NotifyRequest, opts ...grpc.CallOption) (*NotifyResponse, error)
// Answer asks the plugin for something and waits. The deadline is on the
// context; a plugin that misses it is skipped and the caller is told so.
Answer(ctx context.Context, in *AnswerRequest, opts ...grpc.CallOption) (*AnswerResponse, error)
// Serve hands over one HTTP request made to /plugin/<name>/..., and takes
// back what to answer with. It is how a plugin puts a page or an endpoint on
// the operator's server without being linked into it.
//
// One request, one response, both whole: there is no streaming and no
// upgrade, so a plugin cannot hold a connection open against the host. The
// host caps both bodies and the time this may take, and a plugin that misses
// the deadline is answered for.
Serve(ctx context.Context, in *ServeRequest, opts ...grpc.CallOption) (*ServeResponse, error)
}
PluginClient is the client API for Plugin service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
Plugin is what every plugin serves. Four calls, matching the four things a host does: ask what to configure, say what happened, ask for something, and hand over a request somebody made of it.
func NewPluginClient ¶
func NewPluginClient(cc grpc.ClientConnInterface) PluginClient
type PluginServer ¶
type PluginServer interface {
// Settings declares what the operator has to fill in. The host asks once,
// when the plugin starts, and stores the answer so the panel can render the
// form whether or not the plugin is running.
Settings(context.Context, *SettingsRequest) (*SettingsResponse, error)
// Notify tells the plugin something happened. The host does not wait for the
// answer before carrying on with its own work, but the answer still carries
// what the call spent, because a plugin that burns the operator's tokens on
// an event must be metered like any other call.
Notify(context.Context, *NotifyRequest) (*NotifyResponse, error)
// Answer asks the plugin for something and waits. The deadline is on the
// context; a plugin that misses it is skipped and the caller is told so.
Answer(context.Context, *AnswerRequest) (*AnswerResponse, error)
// Serve hands over one HTTP request made to /plugin/<name>/..., and takes
// back what to answer with. It is how a plugin puts a page or an endpoint on
// the operator's server without being linked into it.
//
// One request, one response, both whole: there is no streaming and no
// upgrade, so a plugin cannot hold a connection open against the host. The
// host caps both bodies and the time this may take, and a plugin that misses
// the deadline is answered for.
Serve(context.Context, *ServeRequest) (*ServeResponse, error)
// contains filtered or unexported methods
}
PluginServer is the server API for Plugin service. All implementations must embed UnimplementedPluginServer for forward compatibility.
Plugin is what every plugin serves. Four calls, matching the four things a host does: ask what to configure, say what happened, ask for something, and hand over a request somebody made of it.
type ServeRequest ¶
type ServeRequest struct {
// method is the HTTP method, uppercased.
Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"`
// path is what follows /plugin/<name>, always beginning with a slash. The
// plugin's own routing starts here.
Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
// query is the raw query string, without the leading question mark.
Query string `protobuf:"bytes,3,opt,name=query,proto3" json:"query,omitempty"`
// headers are the request's headers, canonicalised, minus the ones that
// belong to the host: no cookie of the host's own reaches a plugin, because
// a plugin holding the operator's admin session would be the operator.
Headers map[string]*HeaderValues `` /* 141-byte string literal not displayed */
// body is the request body, already capped by the host.
Body []byte `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"`
// caller is what the host knows about whoever made the request.
Caller *Caller `protobuf:"bytes,6,opt,name=caller,proto3" json:"caller,omitempty"`
// prefix is the address this plugin is mounted at, so that it can build
// links and form actions that come back to itself.
Prefix string `protobuf:"bytes,7,opt,name=prefix,proto3" json:"prefix,omitempty"`
// base_url is the operator's own public address, for the links a plugin
// sends somewhere else and expects back.
BaseUrl string `protobuf:"bytes,8,opt,name=base_url,json=baseUrl,proto3" json:"base_url,omitempty"`
// values_json and secrets are the plugin's configuration, on the same terms
// as every other call.
ValuesJson []byte `protobuf:"bytes,9,opt,name=values_json,json=valuesJson,proto3" json:"values_json,omitempty"`
Secrets map[string]string `` /* 142-byte string literal not displayed */
// contains filtered or unexported fields
}
ServeRequest is one HTTP request, forwarded whole.
func (*ServeRequest) Descriptor
deprecated
func (*ServeRequest) Descriptor() ([]byte, []int)
Deprecated: Use ServeRequest.ProtoReflect.Descriptor instead.
func (*ServeRequest) GetBaseUrl ¶
func (x *ServeRequest) GetBaseUrl() string
func (*ServeRequest) GetBody ¶
func (x *ServeRequest) GetBody() []byte
func (*ServeRequest) GetCaller ¶
func (x *ServeRequest) GetCaller() *Caller
func (*ServeRequest) GetHeaders ¶
func (x *ServeRequest) GetHeaders() map[string]*HeaderValues
func (*ServeRequest) GetMethod ¶
func (x *ServeRequest) GetMethod() string
func (*ServeRequest) GetPath ¶
func (x *ServeRequest) GetPath() string
func (*ServeRequest) GetPrefix ¶
func (x *ServeRequest) GetPrefix() string
func (*ServeRequest) GetQuery ¶
func (x *ServeRequest) GetQuery() string
func (*ServeRequest) GetSecrets ¶
func (x *ServeRequest) GetSecrets() map[string]string
func (*ServeRequest) GetValuesJson ¶
func (x *ServeRequest) GetValuesJson() []byte
func (*ServeRequest) ProtoMessage ¶
func (*ServeRequest) ProtoMessage()
func (*ServeRequest) ProtoReflect ¶
func (x *ServeRequest) ProtoReflect() protoreflect.Message
func (*ServeRequest) Reset ¶
func (x *ServeRequest) Reset()
func (*ServeRequest) String ¶
func (x *ServeRequest) String() string
type ServeResponse ¶
type ServeResponse struct {
// status is the HTTP status code. Zero means 200.
Status uint32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`
// headers are the headers to write. The host refuses the ones that are its
// own to decide, and allows a plugin to set only its own cookies.
Headers map[string]*HeaderValues `` /* 141-byte string literal not displayed */
// body is the response body, capped by the host.
Body []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"`
// sign_in asks the host to establish a driver session for this browser, by
// the driver's slug. It is how a plugin that authenticates drivers hands the
// result back: the plugin says who, and the host mints the session. A plugin
// never sees a session token and cannot make one.
SignIn string `protobuf:"bytes,4,opt,name=sign_in,json=signIn,proto3" json:"sign_in,omitempty"`
// sign_out ends whatever driver session this browser has.
SignOut bool `protobuf:"varint,5,opt,name=sign_out,json=signOut,proto3" json:"sign_out,omitempty"`
// usage_json is what serving the request cost, if anything, on the same
// terms as every other call.
UsageJson []byte `protobuf:"bytes,6,opt,name=usage_json,json=usageJson,proto3" json:"usage_json,omitempty"`
// contains filtered or unexported fields
}
ServeResponse is what to answer with.
func (*ServeResponse) Descriptor
deprecated
func (*ServeResponse) Descriptor() ([]byte, []int)
Deprecated: Use ServeResponse.ProtoReflect.Descriptor instead.
func (*ServeResponse) GetBody ¶
func (x *ServeResponse) GetBody() []byte
func (*ServeResponse) GetHeaders ¶
func (x *ServeResponse) GetHeaders() map[string]*HeaderValues
func (*ServeResponse) GetSignIn ¶
func (x *ServeResponse) GetSignIn() string
func (*ServeResponse) GetSignOut ¶
func (x *ServeResponse) GetSignOut() bool
func (*ServeResponse) GetStatus ¶
func (x *ServeResponse) GetStatus() uint32
func (*ServeResponse) GetUsageJson ¶
func (x *ServeResponse) GetUsageJson() []byte
func (*ServeResponse) ProtoMessage ¶
func (*ServeResponse) ProtoMessage()
func (*ServeResponse) ProtoReflect ¶
func (x *ServeResponse) ProtoReflect() protoreflect.Message
func (*ServeResponse) Reset ¶
func (x *ServeResponse) Reset()
func (*ServeResponse) String ¶
func (x *ServeResponse) String() string
type SettingsRequest ¶
type SettingsRequest struct {
// contains filtered or unexported fields
}
SettingsRequest is empty. What a plugin needs configured cannot depend on the configuration, or a fresh installation would have no way in.
func (*SettingsRequest) Descriptor
deprecated
func (*SettingsRequest) Descriptor() ([]byte, []int)
Deprecated: Use SettingsRequest.ProtoReflect.Descriptor instead.
func (*SettingsRequest) ProtoMessage ¶
func (*SettingsRequest) ProtoMessage()
func (*SettingsRequest) ProtoReflect ¶
func (x *SettingsRequest) ProtoReflect() protoreflect.Message
func (*SettingsRequest) Reset ¶
func (x *SettingsRequest) Reset()
func (*SettingsRequest) String ¶
func (x *SettingsRequest) String() string
type SettingsResponse ¶
type SettingsResponse struct {
SettingsJson []byte `protobuf:"bytes,1,opt,name=settings_json,json=settingsJson,proto3" json:"settings_json,omitempty"`
// contains filtered or unexported fields
}
SettingsResponse carries a JSON array of Setting.
func (*SettingsResponse) Descriptor
deprecated
func (*SettingsResponse) Descriptor() ([]byte, []int)
Deprecated: Use SettingsResponse.ProtoReflect.Descriptor instead.
func (*SettingsResponse) GetSettingsJson ¶
func (x *SettingsResponse) GetSettingsJson() []byte
func (*SettingsResponse) ProtoMessage ¶
func (*SettingsResponse) ProtoMessage()
func (*SettingsResponse) ProtoReflect ¶
func (x *SettingsResponse) ProtoReflect() protoreflect.Message
func (*SettingsResponse) Reset ¶
func (x *SettingsResponse) Reset()
func (*SettingsResponse) String ¶
func (x *SettingsResponse) String() string
type UnimplementedPluginServer ¶
type UnimplementedPluginServer struct{}
UnimplementedPluginServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedPluginServer) Answer ¶
func (UnimplementedPluginServer) Answer(context.Context, *AnswerRequest) (*AnswerResponse, error)
func (UnimplementedPluginServer) Notify ¶
func (UnimplementedPluginServer) Notify(context.Context, *NotifyRequest) (*NotifyResponse, error)
func (UnimplementedPluginServer) Serve ¶
func (UnimplementedPluginServer) Serve(context.Context, *ServeRequest) (*ServeResponse, error)
func (UnimplementedPluginServer) Settings ¶
func (UnimplementedPluginServer) Settings(context.Context, *SettingsRequest) (*SettingsResponse, error)
type UnsafePluginServer ¶
type UnsafePluginServer interface {
// contains filtered or unexported methods
}
UnsafePluginServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to PluginServer will result in compilation errors.