source

package
v3.10.6 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MPL-2.0 Imports: 28 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTitleExceptions = map[string]string{

	"acl":   "ACL",
	"acls":  "ACLs",
	"api":   "API",
	"apis":  "APIs",
	"ca":    "CA",
	"cidr":  "CIDR",
	"cidrs": "CIDRs",
	"db":    "DB",
	"dbs":   "DBs",
	"dhcp":  "DHCP",
	"iam":   "IAM",
	"iot":   "IOT",
	"ip":    "IP",
	"ips":   "IPs",
	"ipv4":  "IPv4",
	"ipv6":  "IPv6",
	"mfa":   "MFA",
	"ml":    "ML",
	"oauth": "OAuth",
	"vpc":   "VPC",
	"vpcs":  "VPCs",
	"vpn":   "VPN",
	"vpns":  "VPNs",
	"waf":   "WAF",
	"wafs":  "WAFs",

	"aws": "AWS",
	"gcp": "GCP",
}

Functions

func DefaultTitleTransformer

func DefaultTitleTransformer(table *schema.Table) string

func TestPluginSync

func TestPluginSync(t *testing.T, plugin *Plugin, spec specs.Source, opts ...TestPluginOption)

Types

type GetTables

type GetTables func(ctx context.Context, c schema.ClientMeta) (schema.Tables, error)

type Metrics

type Metrics struct {
	TableClient map[string]map[string]*TableClientMetrics
}

func (*Metrics) Equal

func (s *Metrics) Equal(other *Metrics) bool

Equal compares to stats. Mostly useful in testing

func (*Metrics) InProgressTables added in v3.8.0

func (s *Metrics) InProgressTables() []string

func (*Metrics) MarkEnd added in v3.8.0

func (s *Metrics) MarkEnd(table *schema.Table, clientID string)

if the table is a top-level table, we need to mark all of its descendents as 'done' as well. This is because, when a top-level table is empty (no resources), its descendants are never actually synced.

func (*Metrics) MarkStart added in v3.8.0

func (s *Metrics) MarkStart(table *schema.Table, clientID string)

func (*Metrics) QueuedTables added in v3.8.0

func (s *Metrics) QueuedTables() []string

func (*Metrics) TotalErrors

func (s *Metrics) TotalErrors() uint64

func (*Metrics) TotalErrorsAtomic

func (s *Metrics) TotalErrorsAtomic() uint64

func (*Metrics) TotalPanics

func (s *Metrics) TotalPanics() uint64

func (*Metrics) TotalPanicsAtomic

func (s *Metrics) TotalPanicsAtomic() uint64

func (*Metrics) TotalResources

func (s *Metrics) TotalResources() uint64

func (*Metrics) TotalResourcesAtomic

func (s *Metrics) TotalResourcesAtomic() uint64

type Option

type Option func(*Plugin)

func WithDynamicTableOption

func WithDynamicTableOption(getDynamicTables GetTables) Option

WithDynamicTableOption allows the plugin to return list of tables after call to New

func WithNoInternalColumns

func WithNoInternalColumns() Option

WithNoInternalColumns won't add internal columns (_cq_id, _cq_parent_cq_id) to the plugin tables

func WithTitleTransformer

func WithTitleTransformer(t func(*schema.Table) string) Option

WithTitleTransformer allows the plugin to control how table names get turned into titles for the generated documentation.

func WithUnmanaged

func WithUnmanaged() Option

type Options

type Options struct {
	Backend backend.Backend
}

type Plugin

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

Plugin is the base structure required to pass to sdk.serve We take a declarative approach to API here similar to Cobra

func NewPlugin

func NewPlugin(name string, version string, tables []*schema.Table, newExecutionClient NewExecutionClientFunc, options ...Option) *Plugin

NewPlugin returns a new plugin with a given name, version, tables, newExecutionClient and additional options.

func (*Plugin) Close

func (p *Plugin) Close(ctx context.Context) error

func (*Plugin) GeneratePluginDocs

func (p *Plugin) GeneratePluginDocs(dir, format string) error

GeneratePluginDocs creates table documentation for the source plugin based on its list of tables

func (*Plugin) GetDynamicTables

func (p *Plugin) GetDynamicTables() schema.Tables

func (*Plugin) HasDynamicTables

func (p *Plugin) HasDynamicTables() bool

func (*Plugin) Init

func (p *Plugin) Init(ctx context.Context, spec specs.Source) error

func (*Plugin) Metrics

func (p *Plugin) Metrics() *Metrics

func (*Plugin) Name

func (p *Plugin) Name() string

Name return the name of this plugin

func (*Plugin) SetLogger

func (p *Plugin) SetLogger(logger zerolog.Logger)

func (*Plugin) Sync

func (p *Plugin) Sync(ctx context.Context, syncTime time.Time, res chan<- *schema.Resource) error

Sync is syncing data from the requested tables in spec to the given channel

func (*Plugin) Tables

func (p *Plugin) Tables() schema.Tables

Tables returns all tables supported by this source plugin

func (*Plugin) TablesForSpec

func (p *Plugin) TablesForSpec(spec specs.Source) (schema.Tables, error)

TablesForSpec returns all tables supported by this source plugin that match the given spec. It validates the tables part of the spec and will return an error if it is found to be invalid. This is deprecated method

func (*Plugin) Version

func (p *Plugin) Version() string

Version returns the version of this plugin

type TableClientMetrics

type TableClientMetrics struct {
	// These should only be accessed with 'Atomic*' methods.
	Resources uint64
	Errors    uint64
	Panics    uint64
	// contains filtered or unexported fields
}

func (*TableClientMetrics) Equal

func (s *TableClientMetrics) Equal(other *TableClientMetrics) bool

type TestPluginOption

type TestPluginOption func(*testPluginOptions)

func WithTestPluginAdditionalValidators

func WithTestPluginAdditionalValidators(v Validator) TestPluginOption

func WithTestPluginNoParallel

func WithTestPluginNoParallel() TestPluginOption

type UnmanagedClient

type UnmanagedClient interface {
	schema.ClientMeta
	Sync(ctx context.Context, metrics *Metrics, res chan<- *schema.Resource) error
}

type Validator

type Validator func(t *testing.T, plugin *Plugin, resources []*schema.Resource)

Jump to

Keyboard shortcuts

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