cqproto

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MPL-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CQPlugin

type CQPlugin struct {
	// GRPCPlugin must still implement the Stub interface
	plugin.Plugin
	// Concrete implementation, written in Go. This is only used for plugins
	// that are written in Go.
	Impl CQProviderServer
}

CQPlugin This is the implementation of plugin.GRPCServer so we can serve/consume this.

func (*CQPlugin) GRPCClient

func (p *CQPlugin) GRPCClient(_ context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*CQPlugin) GRPCServer

func (p *CQPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

type CQProvider

type CQProvider interface {
	// GetProviderSchema is called when CloudQuery needs to know what the
	// provider's tables and version
	GetProviderSchema(context.Context, *GetProviderSchemaRequest) (*GetProviderSchemaResponse, error)

	// GetProviderConfig is called when CloudQuery wants to generate a configuration example for a provider
	GetProviderConfig(context.Context, *GetProviderConfigRequest) (*GetProviderConfigResponse, error)

	// ConfigureProvider is called to pass the user-specified provider
	// configuration to the provider.
	ConfigureProvider(context.Context, *ConfigureProviderRequest) (*ConfigureProviderResponse, error)

	// FetchResources is called when CloudQuery requests to fetch one or more resources from the provider
	// The provider reports back status updates on the resources fetching progress.
	FetchResources(context.Context, *FetchResourcesRequest) (FetchResourcesStream, error)
}

type CQProviderServer

type CQProviderServer interface {
	// GetProviderSchema is called when CloudQuery needs to know what the
	// provider's tables and version
	GetProviderSchema(context.Context, *GetProviderSchemaRequest) (*GetProviderSchemaResponse, error)

	// GetProviderConfig is called when CloudQuery wants to generate a configuration example for a provider
	GetProviderConfig(context.Context, *GetProviderConfigRequest) (*GetProviderConfigResponse, error)

	// ConfigureProvider is called to pass the user-specified provider
	// configuration to the provider.
	ConfigureProvider(context.Context, *ConfigureProviderRequest) (*ConfigureProviderResponse, error)

	// FetchResources is called when CloudQuery requests to fetch one or more resources from the provider
	// The provider reports back status updates on the resources fetching progress.
	FetchResources(context.Context, *FetchResourcesRequest, FetchResourcesSender) error
}

type ConfigureProviderRequest

type ConfigureProviderRequest struct {
	// CloudQueryVersion is the version of CloudQuery executing the request.
	CloudQueryVersion string
	// ConnectionDetails holds information regarding connection to the CloudQuery database
	Connection ConnectionDetails
	// Config is the configuration the user supplied for the provider
	Config []byte
	// DisableDelete configures providers to skip deletion of data before resource fetch
	DisableDelete bool
	// Fields to inject to every resource on insert
	ExtraFields map[string]interface{}
}

type ConfigureProviderResponse

type ConfigureProviderResponse struct {
	// Error should be set to a string describing the error.
	// The error can be either from malformed configuration or failure to setup
	Error string
}

type ConnectionDetails

type ConnectionDetails struct {
	Type string
	DSN  string
}

type FetchResourcesRequest

type FetchResourcesRequest struct {
	Resources []string
}

FetchResourcesRequest represents a CloudQuery RPC request of one or more resources

type FetchResourcesResponse

type FetchResourcesResponse struct {
	// map of resources that have finished fetching
	FinishedResources map[string]bool
	// Amount of resources collected so far
	ResourceCount uint64
	// Error value if any, if returned the stream will be canceled
	Error string
}

FetchResourcesResponse represents a CloudQuery RPC response of the current fetch progress of the provider

type FetchResourcesSender

type FetchResourcesSender interface {
	Send(*FetchResourcesResponse) error
}

FetchResourcesSender represents a CloudQuery RPC stream of fetch updates from the provider

type FetchResourcesStream

type FetchResourcesStream interface {
	Recv() (*FetchResourcesResponse, error)
}

FetchResourcesStream represents a CloudQuery RPC stream of fetch updates from the provider

type GRPCClient

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

func (GRPCClient) ConfigureProvider

func (g GRPCClient) ConfigureProvider(ctx context.Context, request *ConfigureProviderRequest) (*ConfigureProviderResponse, error)

func (GRPCClient) FetchResources

func (g GRPCClient) FetchResources(ctx context.Context, request *FetchResourcesRequest) (FetchResourcesStream, error)

func (GRPCClient) GetProviderConfig

func (GRPCClient) GetProviderSchema

type GRPCFetchResourcesServer

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

func (GRPCFetchResourcesServer) Send

type GRPCFetchResponseStream

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

func (GRPCFetchResponseStream) Recv

type GRPCServer

type GRPCServer struct {
	// This is the real implementation
	Impl CQProviderServer
	internal.UnimplementedProviderServer
}

func (*GRPCServer) ConfigureProvider

func (*GRPCServer) FetchResources

type GetProviderConfigRequest

type GetProviderConfigRequest struct{}

GetProviderConfigRequest represents a CloudQuery RPC request for provider's config

type GetProviderConfigResponse

type GetProviderConfigResponse struct {
	Config []byte
}

type GetProviderSchemaRequest

type GetProviderSchemaRequest struct{}

GetProviderSchemaRequest represents a CloudQuery RPC request for provider's schemas

type GetProviderSchemaResponse

type GetProviderSchemaResponse struct {
	// Name is the name of the provider being executed
	Name string
	// Version is the current version provider being executed
	Version string
	// ResourceTables is a map of tables this provider creates
	ResourceTables map[string]*schema.Table
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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