Documentation ¶
Index ¶
- Constants
- Variables
- func APIBaseURL() string
- func GenerateRandomUnixSocketName() string
- func WithBinarySuffix(filePath string) string
- type AssetSource
- func AssetSourceFromString(s string) (AssetSource, error)
- func DownloadPluginFromGithub(ctx context.Context, logger zerolog.Logger, localPath string, org string, ...) (AssetSource, error)
- func DownloadPluginFromHub(ctx context.Context, c *cloudquery_api.ClientWithResponses, ...) (AssetSource, error)
- type Client
- type Clients
- type Config
- type DownloaderOptions
- type HubDownloadOptions
- type LogReader
- type Metrics
- type Option
- func WithAuthToken(authToken string) Option
- func WithCloudQueryDockerHost(dockerHost string) Option
- func WithDirectory(directory string) Option
- func WithDockerExtraHosts(extraHosts []string) Option
- func WithLicenseFile(licenseFile string) Option
- func WithLogger(logger zerolog.Logger) Option
- func WithNoExec() Option
- func WithNoProgress() Option
- func WithNoSentry() Option
- func WithOtelEndpoint(endpoint string) Option
- func WithOtelEndpointInsecure() Option
- func WithTeamName(teamName string) Option
- func WithUseTCP() Option
- type PluginType
- type Registry
Constants ¶
const ( DefaultDownloadDir = ".cq" RetryAttempts = 5 RetryWaitTime = 1 * time.Second )
const (
DefaultCloudQueryDockerHost = "docker.cloudquery.io"
)
Variables ¶
var ( ErrLoginRequired = fmt.Errorf("login required") ErrTeamRequired = fmt.Errorf("team required") )
var (
ErrLogLineToLong = errors.New("log line too long, discarding")
)
Functions ¶
func APIBaseURL ¶ added in v1.11.0
func APIBaseURL() string
func GenerateRandomUnixSocketName ¶
func GenerateRandomUnixSocketName() string
func WithBinarySuffix ¶
Types ¶
type AssetSource ¶ added in v1.20.0
type AssetSource int
const ( AssetSourceUnknown AssetSource = iota AssetSourceCached AssetSourceRemote )
func AssetSourceFromString ¶ added in v1.20.0
func AssetSourceFromString(s string) (AssetSource, error)
func DownloadPluginFromGithub ¶
func DownloadPluginFromGithub(ctx context.Context, logger zerolog.Logger, localPath string, org string, name string, version string, typ PluginType, dops DownloaderOptions) (AssetSource, error)
func DownloadPluginFromHub ¶ added in v1.11.0
func DownloadPluginFromHub(ctx context.Context, c *cloudquery_api.ClientWithResponses, ops HubDownloadOptions, dops DownloaderOptions) (AssetSource, error)
func (AssetSource) MarshalJSON ¶ added in v1.20.0
func (r AssetSource) MarshalJSON() ([]byte, error)
func (AssetSource) String ¶ added in v1.20.0
func (r AssetSource) String() string
func (*AssetSource) UnmarshalJSON ¶ added in v1.20.0
func (r *AssetSource) UnmarshalJSON(data []byte) (err error)
type Client ¶
type Client struct { LocalPath string Conn *grpc.ClientConn // contains filtered or unexported fields }
func NewClient ¶
NewClient creates a new plugin client. If registrySpec is GitHub then client downloads the plugin, spawns it and creates a gRPC connection. If registrySpec is Local then client spawns the plugin and creates a gRPC connection. If registrySpec is gRPC then clients creates a new connection If registrySpec is Docker then client downloads the docker image, runs it and creates a gRPC connection.
func (*Client) ConnectionString ¶ added in v1.6.0
type Clients ¶
type Clients []*Client
func NewClients ¶
func NewClients(ctx context.Context, typ PluginType, specs []Config, opts ...Option) (Clients, error)
typ will be deprecated soon but now required for a transition period
func (Clients) ClientByName ¶
type DownloaderOptions ¶ added in v1.19.19
type DownloaderOptions struct {
NoProgress bool
}
type HubDownloadOptions ¶ added in v1.14.0
type LogReader ¶
type LogReader struct {
// contains filtered or unexported fields
}
logReader is a custom implementation similar to bufio.Scanner, but provides a way to handle lines (or tokens) that exceed the buffer size.
func NewLogReader ¶
func NewLogReader(reader io.ReadCloser) *LogReader
newLogReader creates a new logReader to read log lines from an io.ReadCloser
func (*LogReader) NextLine ¶
NextLine reads and returns the next log line from the reader. An io.EOF error is returned if the end of the stream has been reached. This implementation is different from bufio.Scanner as it also returns an error if a line is too long to fit into the buffer. In this case, an error is returned together with a limited prefix of the line.
type Metrics ¶ added in v1.2.0
type Metrics struct { Errors uint64 Warnings uint64 AssetSource AssetSource }
type Option ¶
type Option func(*Client)
func WithAuthToken ¶ added in v1.13.0
func WithCloudQueryDockerHost ¶ added in v1.17.0
func WithDirectory ¶
func WithDockerExtraHosts ¶ added in v1.22.0
func WithLicenseFile ¶ added in v1.15.0
func WithLogger ¶
func WithNoExec ¶ added in v1.10.0
func WithNoExec() Option
func WithNoProgress ¶ added in v1.19.19
func WithNoProgress() Option
func WithNoSentry ¶
func WithNoSentry() Option
func WithOtelEndpoint ¶ added in v1.8.0
func WithOtelEndpointInsecure ¶ added in v1.8.0
func WithOtelEndpointInsecure() Option
func WithTeamName ¶ added in v1.14.0
func WithUseTCP ¶ added in v1.22.0
func WithUseTCP() Option
type PluginType ¶
type PluginType int
PluginType specifies if a plugin is a source or a destination. It actually doesn't really have any effect as plugins can serve both as source and as destinations, but it is here for backward compatibility.
const ( PluginSource PluginType = iota PluginDestination PluginTransformer )
func (PluginType) String ¶
func (p PluginType) String() string
type Registry ¶
type Registry int