Documentation
¶
Index ¶
- Variables
- func ServePlugin(optFns ...func(*serveOption)) error
- func WithProviderPlugin(impl Provider) func(*serveOption)
- type AttributeSchema
- type BlockSchema
- type Client
- type GRPCClient
- type GRPCServer
- func (m *GRPCServer) GetQuerySchema(ctx context.Context, _ *paproto.GetQuerySchema_Request) (*paproto.GetQuerySchema_Response, error)
- func (m *GRPCServer) RunQuery(ctx context.Context, r *paproto.RunQuery_Request) (*paproto.RunQuery_Response, error)
- func (m *GRPCServer) ValidateProviderParameter(ctx context.Context, r *paproto.ValidatProviderPaameter_Request) (*paproto.ValidatProviderPaameter_Response, error)
- type Provider
- type ProviderPlugin
- type RemoteProvider
- type RemoteProviderFactory
- type RemoteQuery
- type RunQueryRequest
- type RunQueryResponse
- type Schema
Constants ¶
This section is empty.
Variables ¶
View Source
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "PREPALERT_PLUGIN_MAGIC_COOKIE",
MagicCookieValue: "prepalert-grpc-plugin-protocol",
}
View Source
var PluginMap = map[string]plugin.Plugin{ "provider": &ProviderPlugin{}, }
Functions ¶
func ServePlugin ¶
func ServePlugin(optFns ...func(*serveOption)) error
func WithProviderPlugin ¶
func WithProviderPlugin(impl Provider) func(*serveOption)
Types ¶
type AttributeSchema ¶
type BlockSchema ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) NewProviderService ¶
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
func (*GRPCClient) GetQuerySchema ¶
func (m *GRPCClient) GetQuerySchema(ctx context.Context) (*Schema, error)
func (*GRPCClient) RunQuery ¶
func (m *GRPCClient) RunQuery(ctx context.Context, req *RunQueryRequest) (*RunQueryResponse, error)
func (*GRPCClient) ValidateProviderParameter ¶
func (m *GRPCClient) ValidateProviderParameter(ctx context.Context, pp *provider.ProviderParameter) error
type GRPCServer ¶
type GRPCServer struct {
// This is the real implementation
Impl Provider
paproto.UnimplementedProviderServer
}
Here is the gRPC server that GRPCClient talks to.
func (*GRPCServer) GetQuerySchema ¶
func (m *GRPCServer) GetQuerySchema(ctx context.Context, _ *paproto.GetQuerySchema_Request) (*paproto.GetQuerySchema_Response, error)
func (*GRPCServer) RunQuery ¶
func (m *GRPCServer) RunQuery(ctx context.Context, r *paproto.RunQuery_Request) (*paproto.RunQuery_Response, error)
func (*GRPCServer) ValidateProviderParameter ¶
func (m *GRPCServer) ValidateProviderParameter(ctx context.Context, r *paproto.ValidatProviderPaameter_Request) (*paproto.ValidatProviderPaameter_Response, error)
type Provider ¶
type Provider interface {
ValidateProviderParameter(ctx context.Context, pp *provider.ProviderParameter) error
GetQuerySchema(ctx context.Context) (*Schema, error)
RunQuery(ctx context.Context, req *RunQueryRequest) (*RunQueryResponse, error)
}
type ProviderPlugin ¶
func (*ProviderPlugin) GRPCClient ¶
func (p *ProviderPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*ProviderPlugin) GRPCServer ¶
func (p *ProviderPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type RemoteProvider ¶
type RemoteProvider struct {
// contains filtered or unexported fields
}
type RemoteProviderFactory ¶
type RemoteProviderFactory struct {
// contains filtered or unexported fields
}
func (*RemoteProviderFactory) NewProvider ¶
func (f *RemoteProviderFactory) NewProvider(pp *provider.ProviderParameter) (*RemoteProvider, error)
type RemoteQuery ¶
type RemoteQuery struct {
// contains filtered or unexported fields
}
func (*RemoteQuery) Run ¶
func (rq *RemoteQuery) Run(ctx context.Context, evalCtx *hcl.EvalContext) (*provider.QueryResult, error)
type RunQueryRequest ¶
type RunQueryRequest struct {
ProviderParameters *provider.ProviderParameter
QueryName string
QueryParameters json.RawMessage
}
type RunQueryResponse ¶
type RunQueryResponse struct {
Name string
Query string
Params []json.RawMessage
Columns []string
Rows [][]string
JSONLines []json.RawMessage
}
type Schema ¶
type Schema struct {
Attributes []AttributeSchema
Blocks []BlockSchema
}
func NewSchemaWithProto ¶
Click to show internal directories.
Click to hide internal directories.