source

package
v1.45.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: MPL-2.0 Imports: 29 Imported by: 30

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 added in v1.43.0

func DefaultTitleTransformer(table *schema.Table) string

func TestPluginSync

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

Types

type GetTables added in v1.28.0

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) TotalErrors

func (s *Metrics) TotalErrors() uint64

func (*Metrics) TotalErrorsAtomic added in v1.14.0

func (s *Metrics) TotalErrorsAtomic() uint64

func (*Metrics) TotalPanics

func (s *Metrics) TotalPanics() uint64

func (*Metrics) TotalPanicsAtomic added in v1.14.0

func (s *Metrics) TotalPanicsAtomic() uint64

func (*Metrics) TotalResources

func (s *Metrics) TotalResources() uint64

func (*Metrics) TotalResourcesAtomic added in v1.14.0

func (s *Metrics) TotalResourcesAtomic() uint64

type Option added in v1.24.0

type Option func(*Plugin)

func WithDynamicTableOption added in v1.28.0

func WithDynamicTableOption(getDynamicTables GetTables) Option

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

func WithNoInternalColumns added in v1.37.0

func WithNoInternalColumns() Option

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

func WithTitleTransformer added in v1.43.0

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 added in v1.37.0

func WithUnmanaged() Option

type Options added in v1.24.0

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 added in v1.28.0

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 added in v1.28.0

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

func (*Plugin) HasDynamicTables added in v1.28.0

func (p *Plugin) HasDynamicTables() bool

func (*Plugin) Init added in v1.28.0

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, 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 {
	Resources uint64
	Errors    uint64
	Panics    uint64
	StartTime time.Time
	EndTime   time.Time
}

func (*TableClientMetrics) Equal

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

type TestPluginOption

type TestPluginOption func(*testPluginOptions)

func WithTestPluginAdditionalValidators added in v1.35.0

func WithTestPluginAdditionalValidators(v Validator) TestPluginOption

func WithTestPluginNoParallel

func WithTestPluginNoParallel() TestPluginOption

type UnmanagedClient added in v1.37.0

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

type Validator added in v1.35.0

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