cqproto

package
v0.6.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2021 License: MPL-2.0 Imports: 8 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 FailedResourceFetch added in v0.5.0

type FailedResourceFetch struct {
	// table name of the failed resource fetch
	TableName string
	// root/parent table name
	RootTableName string
	// root/parent primary key values
	RootPrimaryKeyValues []string
	// error message for this resource fetch failure
	Error string
}

func PartialFetchToCQProto added in v0.4.0

func PartialFetchToCQProto(in []schema.ResourceFetchError) []*FailedResourceFetch

PartialFetchToCQProto converts schema partial fetch failed resources to cq-proto partial fetch resources

type FetchResourcesRequest

type FetchResourcesRequest struct {
	// List of resources to fetch
	Resources []string
	// PartialFetchingEnabled if true enables partial fetching
	PartialFetchingEnabled bool
	// ParallelFetchingLimit limits parallel resources fetch at a time is more than 0
	ParallelFetchingLimit uint64
}

FetchResourcesRequest represents a CloudQuery RPC request of one or more resources

type FetchResourcesResponse

type FetchResourcesResponse struct {
	ResourceName string
	// 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
	// list of resources where the fetching failed
	PartialFetchFailedResources []*FailedResourceFetch
	// fetch summary of resource that finished execution
	Summary ResourceFetchSummary
}

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
	// Migrations scripts available for the provider
	Migrations map[string][]byte
}

type ProviderDiagnostic added in v0.5.0

type ProviderDiagnostic struct {
	ResourceName       string
	DiagnosticType     diag.DiagnosticType
	DiagnosticSeverity diag.Severity
	Summary            string
	Details            string
}

func (ProviderDiagnostic) Description added in v0.5.0

func (p ProviderDiagnostic) Description() diag.Description

func (ProviderDiagnostic) Error added in v0.5.5

func (p ProviderDiagnostic) Error() string

func (ProviderDiagnostic) Severity added in v0.5.0

func (p ProviderDiagnostic) Severity() diag.Severity

func (ProviderDiagnostic) Type added in v0.5.0

type ResourceFetchStatus added in v0.5.0

type ResourceFetchStatus int

ResourceFetchStatus defines execution status of the resource fetch execution

const (
	// ResourceFetchComplete execution was completed successfully without any errors/diagnostics
	ResourceFetchComplete ResourceFetchStatus = iota
	// ResourceFetchFailed execution failed and wasn't able to fetch any resource
	ResourceFetchFailed
	// ResourceFetchPartial execution was partial, one or more resources failed to resolve/fetch
	ResourceFetchPartial
	// ResourceFetchCanceled execution was canceled preemptively
	ResourceFetchCanceled
)

type ResourceFetchSummary added in v0.5.0

type ResourceFetchSummary struct {
	// Execution status of resource
	Status ResourceFetchStatus
	// Total Amount of resources collected by this resource
	ResourceCount uint64
	// Diagnostics of failed resource fetch, the diagnostic provides insights such as severity, summary and
	// details on how to solve this issue
	Diagnostics diag.Diagnostics
}

ResourceFetchSummary includes a summarized report of a fetched resource, such as total amount of resources collected, status of the fetch and any diagnostics found while executing fetch on it.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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