cqproto

package
v0.13.5 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: MPL-2.0 Imports: 9 Imported by: 6

Documentation

Index

Constants

View Source
const (
	V4 = 4
	V5 = 5

	Vunmanaged = -1
)
View Source
const (
	ConfigHCL  = ConfigFormat(0) // Deprecated
	ConfigYAML = ConfigFormat(1)
)

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 (*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)

	// Gets info about specific module config embedded inside provider
	GetModuleInfo(context.Context, *GetModuleRequest) (*GetModuleResponse, 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

	// Gets info about specific module config embedded inside provider
	GetModuleInfo(context.Context, *GetModuleRequest) (*GetModuleResponse, error)
}

type ConfigFormat added in v0.12.0

type ConfigFormat int

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
	// ConfigFormat is the format of the passed config
	Format ConfigFormat
}

type ConfigureProviderResponse

type ConfigureProviderResponse struct {
	// Diagnostics about the configure action. If includes ERROR severity, operation is aborted.
	// The error can be either from malformed configuration or failure to setup
	Diagnostics diag.Diagnostics
}

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
}

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
	// MaxGoroutines specified an approximate maximum number of goroutines that will be spanwd during fetch
	MaxGoroutines uint64
	// Timeout for each parent resource resolve call
	Timeout time.Duration
	// Metadata for the fetch
	Metadata map[string]interface{}
}

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) GetModuleInfo added in v0.8.1

func (g GRPCClient) GetModuleInfo(ctx context.Context, request *GetModuleRequest) (*GetModuleResponse, error)

func (GRPCClient) GetProviderConfig

func (g GRPCClient) GetProviderConfig(ctx context.Context, request *GetProviderConfigRequest) (*GetProviderConfigResponse, error)

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

func (*GRPCServer) GetModuleInfo added in v0.8.1

func (*GRPCServer) GetProviderConfig

type GetModuleRequest added in v0.8.1

type GetModuleRequest struct {
	Module            string
	PreferredVersions []uint32
}

GetModuleRequest represents a CloudQuery RPC request of provider's module info for specific provider

type GetModuleResponse added in v0.8.1

type GetModuleResponse struct {
	Data              map[uint32]ModuleInfo // version vs Info
	AvailableVersions []uint32              // all available versions, regardless of being requested in PreferredVersions or not
	Diagnostics       diag.Diagnostics
}

GetModuleResponse represents a CloudQuery RPC response of provider's module info for specific provider

type GetProviderConfigRequest

type GetProviderConfigRequest struct {
	Format ConfigFormat
}

GetProviderConfigRequest represents a CloudQuery RPC request for provider's config

type GetProviderConfigResponse

type GetProviderConfigResponse struct {
	Config []byte
	Format ConfigFormat
}

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
}

type ModuleFile added in v0.8.1

type ModuleFile struct {
	Name     string
	Contents []byte
}

ModuleFile is a file definition inside ModuleInfo

type ModuleInfo added in v0.8.1

type ModuleInfo struct {
	Files  []*ModuleFile
	Extras map[string]string
}

ModuleInfo is info about a module

type ProviderDiagnostic added in v0.5.0

type ProviderDiagnostic struct {
	ResourceName       string
	ResourceId         []string
	DiagnosticType     diag.Type
	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

func (p ProviderDiagnostic) Type() diag.Type

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
)

func (ResourceFetchStatus) String added in v0.8.0

func (s ResourceFetchStatus) String() string

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