@@ -6,16 +6,16 @@ import (
66 "sync"
77 "time"
88
9- _ "embed"
10-
119 "github.com/cloudquery/cq-plugin-sdk/helpers"
1210 "github.com/cloudquery/cq-plugin-sdk/helpers/limit"
1311 "github.com/cloudquery/cq-plugin-sdk/schema"
14- "github.com/cloudquery/cq-plugin-sdk/spec "
12+ "github.com/cloudquery/cq-plugin-sdk/specs "
1513 "github.com/rs/zerolog"
1614 "github.com/thoas/go-funk"
1715 "github.com/xeipuuv/gojsonschema"
1816 "golang.org/x/sync/semaphore"
17+
18+ _ "embed"
1919)
2020
2121//go:embed source_schema.json
@@ -38,7 +38,7 @@ type SourcePlugin struct {
3838 // Version of the plugin
3939 Version string
4040 // Called upon configure call to validate and init configuration
41- Configure func (context.Context , * SourcePlugin , spec .SourceSpec ) (schema.ClientMeta , error )
41+ Configure func (context.Context , * SourcePlugin , specs .SourceSpec ) (schema.ClientMeta , error )
4242 // Tables is all tables supported by this source plugin
4343 Tables []* schema.Table
4444 // JsonSchema for specific source plugin spec
@@ -50,11 +50,11 @@ type SourcePlugin struct {
5050
5151 // Internal fields set by configure
5252 clientMeta schema.ClientMeta
53- spec * spec .SourceSpec
53+ spec * specs .SourceSpec
5454}
5555
56- func (p * SourcePlugin ) Init (ctx context.Context , s spec.SourceSpec ) (* gojsonschema.Result , error ) {
57- res , err := spec .ValidateSpec (sourceSchema , s )
56+ func (p * SourcePlugin ) Init (ctx context.Context , spec specs .SourceSpec ) (* gojsonschema.Result , error ) {
57+ res , err := specs .ValidateSpec (sourceSchema , spec )
5858 if err != nil {
5959 return nil , err
6060 }
@@ -64,15 +64,15 @@ func (p *SourcePlugin) Init(ctx context.Context, s spec.SourceSpec) (*gojsonsche
6464 if p .Configure == nil {
6565 return nil , fmt .Errorf ("configure function not defined" )
6666 }
67- p .clientMeta , err = p .Configure (ctx , p , s )
67+ p .clientMeta , err = p .Configure (ctx , p , spec )
6868 if err != nil {
6969 return res , fmt .Errorf ("failed to configure source plugin: %w" , err )
7070 }
71- p .spec = & s
71+ p .spec = & spec
7272 return res , nil
7373}
7474
75- // Fetch fetches data acording to source configuration and
75+ // Fetch fetches data according to source configuration and
7676func (p * SourcePlugin ) Fetch (ctx context.Context , res chan <- * schema.Resource ) error {
7777 if p .spec == nil {
7878 return fmt .Errorf ("source plugin not initialized" )
@@ -89,7 +89,7 @@ func (p *SourcePlugin) Fetch(ctx context.Context, res chan<- *schema.Resource) e
8989 maxGoroutines = limit .GetMaxGoRoutines ()
9090 }
9191 p .Logger .Info ().Uint64 ("max_goroutines" , maxGoroutines ).Msg ("starting fetch" )
92- goroutinesSem := semaphore .NewWeighted (helpers .Uint64ToInt64 (uint64 ( maxGoroutines ) ))
92+ goroutinesSem := semaphore .NewWeighted (helpers .Uint64ToInt64 (maxGoroutines ))
9393
9494 w := sync.WaitGroup {}
9595 for _ , table := range p .Tables {
0 commit comments