From d8f0692ef7a8735b2a01357c45c23fb374820d1a Mon Sep 17 00:00:00 2001 From: Geoff Greer Date: Fri, 16 Feb 2024 14:54:53 -0800 Subject: [PATCH 1/5] Add command line flag to skip syncing disabled users. --- cmd/baton-retool/config.go | 7 ++++--- cmd/baton-retool/main.go | 3 ++- pkg/client/user.go | 5 ++++- pkg/connector/connector.go | 18 ++++++++++-------- pkg/connector/users.go | 14 ++++++++------ 5 files changed, 28 insertions(+), 19 deletions(-) diff --git a/cmd/baton-retool/config.go b/cmd/baton-retool/config.go index ead6e6ba..6e07d522 100644 --- a/cmd/baton-retool/config.go +++ b/cmd/baton-retool/config.go @@ -11,9 +11,10 @@ import ( type config struct { cli.BaseConfig `mapstructure:",squash"` // Puts the base config options in the same place as the connector options - ConnectionString string `mapstructure:"connection-string"` - SkipPages bool `mapstructure:"skip-pages"` - SkipResources bool `mapstructure:"skip-resources"` + ConnectionString string `mapstructure:"connection-string"` + SkipPages bool `mapstructure:"skip-pages"` + SkipResources bool `mapstructure:"skip-resources"` + SkipDisabledUsers bool `mapstructure:"skip-disabled-users"` } // validateConfig is run after the configuration is loaded, and should return an error if it isn't valid. diff --git a/cmd/baton-retool/main.go b/cmd/baton-retool/main.go index 6c5c4afe..1711c7b8 100644 --- a/cmd/baton-retool/main.go +++ b/cmd/baton-retool/main.go @@ -36,6 +36,7 @@ func main() { cmd.PersistentFlags().Bool("skip-pages", false, "Skip syncing pages") cmd.PersistentFlags().Bool("skip-resources", false, "Skip syncing resources") + cmd.PersistentFlags().Bool("skip-disabled-users", false, "Skip syncing disabled users") err = cmd.Execute() if err != nil { @@ -47,7 +48,7 @@ func main() { func getConnector(ctx context.Context, cfg *config) (types.ConnectorServer, error) { l := ctxzap.Extract(ctx) - cb, err := connector.New(ctx, cfg.ConnectionString, cfg.SkipPages, cfg.SkipResources) + cb, err := connector.New(ctx, cfg.ConnectionString, cfg.SkipPages, cfg.SkipResources, cfg.SkipDisabledUsers) if err != nil { l.Error("error creating connector builder", zap.Error(err)) return nil, err diff --git a/pkg/client/user.go b/pkg/client/user.go index 16eb00e8..30ba035a 100644 --- a/pkg/client/user.go +++ b/pkg/client/user.go @@ -65,7 +65,7 @@ func (u *UserModel) GetLastLoggedIn() time.Time { return time.Time{} } -func (c *Client) ListUsersForOrg(ctx context.Context, orgID int64, pager *Pager) ([]*UserModel, string, error) { +func (c *Client) ListUsersForOrg(ctx context.Context, orgID int64, pager *Pager, skipDisabledUsers bool) ([]*UserModel, string, error) { l := ctxzap.Extract(ctx) l.Debug("listing users for org", zap.Int64("org_id", orgID)) @@ -78,6 +78,9 @@ func (c *Client) ListUsersForOrg(ctx context.Context, orgID int64, pager *Pager) sb := &strings.Builder{} _, _ = sb.WriteString(`SELECT "id", "email", "firstName", "lastName", "profilePhotoUrl", "enabled", "userName", "organizationId", "lastLoggedIn" from users WHERE "organizationId"=$1 `) args = append(args, orgID) + if skipDisabledUsers { + _, _ = sb.WriteString("AND enabled = true ") + } _, _ = sb.WriteString(`ORDER BY "id" `) _, _ = sb.WriteString("LIMIT $2 ") args = append(args, limit+1) diff --git a/pkg/connector/connector.go b/pkg/connector/connector.go index 1615e186..abb3e809 100644 --- a/pkg/connector/connector.go +++ b/pkg/connector/connector.go @@ -20,9 +20,10 @@ func titleCase(s string) string { } type ConnectorImpl struct { - client *client.Client - skipPages bool - skipResources bool + client *client.Client + skipPages bool + skipResources bool + skipDisabledUsers bool } func (c *ConnectorImpl) Metadata(ctx context.Context) (*v2.ConnectorMetadata, error) { @@ -47,7 +48,7 @@ func (c *ConnectorImpl) Asset(ctx context.Context, asset *v2.AssetRef) (string, func (c *ConnectorImpl) ResourceSyncers(ctx context.Context) []connectorbuilder.ResourceSyncer { syncers := []connectorbuilder.ResourceSyncer{ newOrgSyncer(ctx, c.client, c.skipPages, c.skipResources), - newUserSyncer(ctx, c.client), + newUserSyncer(ctx, c.client, c.skipDisabledUsers), newGroupSyncer(ctx, c.client), } @@ -62,15 +63,16 @@ func (c *ConnectorImpl) ResourceSyncers(ctx context.Context) []connectorbuilder. return syncers } -func New(ctx context.Context, dsn string, skipPages bool, skipResources bool) (*ConnectorImpl, error) { +func New(ctx context.Context, dsn string, skipPages bool, skipResources bool, skipDisabledUsers bool) (*ConnectorImpl, error) { c, err := client.New(ctx, dsn) if err != nil { return nil, err } return &ConnectorImpl{ - client: c, - skipPages: skipPages, - skipResources: skipResources, + client: c, + skipPages: skipPages, + skipResources: skipResources, + skipDisabledUsers: skipDisabledUsers, }, nil } diff --git a/pkg/connector/users.go b/pkg/connector/users.go index eeece3e0..f370b01b 100644 --- a/pkg/connector/users.go +++ b/pkg/connector/users.go @@ -20,8 +20,9 @@ var resourceTypeUser = &v2.ResourceType{ } type userSyncer struct { - resourceType *v2.ResourceType - client *client.Client + resourceType *v2.ResourceType + client *client.Client + skipDisabledUsers bool } func (s *userSyncer) ResourceType(ctx context.Context) *v2.ResourceType { @@ -42,7 +43,7 @@ func (s *userSyncer) List( return nil, "", nil, err } - users, nextPageToken, err := s.client.ListUsersForOrg(ctx, orgID, &client.Pager{Token: pToken.Token, Size: pToken.Size}) + users, nextPageToken, err := s.client.ListUsersForOrg(ctx, orgID, &client.Pager{Token: pToken.Token, Size: pToken.Size}, s.skipDisabledUsers) if err != nil { return nil, "", nil, err } @@ -96,9 +97,10 @@ func (s *userSyncer) Grants(ctx context.Context, resource *v2.Resource, pToken * return nil, "", nil, nil } -func newUserSyncer(ctx context.Context, c *client.Client) *userSyncer { +func newUserSyncer(ctx context.Context, c *client.Client, skipDisabledUsers bool) *userSyncer { return &userSyncer{ - resourceType: resourceTypeUser, - client: c, + resourceType: resourceTypeUser, + client: c, + skipDisabledUsers: skipDisabledUsers, } } From 495283da4cc44ec1b8d83c39e22d6d1823058f13 Mon Sep 17 00:00:00 2001 From: Geoff Greer Date: Fri, 16 Feb 2024 15:38:33 -0800 Subject: [PATCH 2/5] Skip disabled users in group membership and other grants. --- pkg/client/group.go | 9 +++++++-- pkg/connector/connector.go | 8 ++++---- pkg/connector/groups.go | 14 ++++++++------ pkg/connector/organizations.go | 22 ++++++++++++---------- pkg/connector/pages.go | 14 ++++++++------ pkg/connector/resources.go | 14 ++++++++------ 6 files changed, 47 insertions(+), 34 deletions(-) diff --git a/pkg/client/group.go b/pkg/client/group.go index 64895b86..7e9bf2bc 100644 --- a/pkg/client/group.go +++ b/pkg/client/group.go @@ -66,6 +66,7 @@ type GroupMember struct { UserID *int64 `db:"userId"` GroupID *int64 `db:"groupId"` IsAdmin bool `db:"isAdmin"` + Enabled bool `db:"enabled"` } func (g *GroupMember) GetUserID() int64 { @@ -152,7 +153,7 @@ func (c *Client) GetGroupResourceFolderDefault(ctx context.Context, groupID int6 return &ret, nil } -func (c *Client) ListGroupMembers(ctx context.Context, groupID int64, pager *Pager) ([]*GroupMember, string, error) { +func (c *Client) ListGroupMembers(ctx context.Context, groupID int64, pager *Pager, skipDisabledUsers bool) ([]*GroupMember, string, error) { l := ctxzap.Extract(ctx) l.Debug("listing group members for group", zap.Int64("group_id", groupID)) @@ -165,7 +166,11 @@ func (c *Client) ListGroupMembers(ctx context.Context, groupID int64, pager *Pag args = append(args, groupID) sb := &strings.Builder{} - _, _ = sb.WriteString(`select "id", "userId", "groupId", "isAdmin" from user_groups WHERE "groupId"=$1 ORDER BY "id" `) + if skipDisabledUsers { + _, _ = sb.WriteString(`select user_groups.id as id, "userId", "groupId", "isAdmin", users.enabled from user_groups INNER JOIN users ON users.id = "user_groups"."userId" WHERE "groupId"=$1 and users.enabled = true ORDER BY "id" `) + } else { + _, _ = sb.WriteString(`select "id", "userId", "groupId", "isAdmin" from user_groups WHERE "groupId"=$1 ORDER BY "id" `) + } args = append(args, limit+1) _, _ = sb.WriteString(fmt.Sprintf("LIMIT $%d ", len(args))) diff --git a/pkg/connector/connector.go b/pkg/connector/connector.go index abb3e809..0a84d1ef 100644 --- a/pkg/connector/connector.go +++ b/pkg/connector/connector.go @@ -47,17 +47,17 @@ func (c *ConnectorImpl) Asset(ctx context.Context, asset *v2.AssetRef) (string, func (c *ConnectorImpl) ResourceSyncers(ctx context.Context) []connectorbuilder.ResourceSyncer { syncers := []connectorbuilder.ResourceSyncer{ - newOrgSyncer(ctx, c.client, c.skipPages, c.skipResources), + newOrgSyncer(ctx, c.client, c.skipPages, c.skipResources, c.skipDisabledUsers), newUserSyncer(ctx, c.client, c.skipDisabledUsers), - newGroupSyncer(ctx, c.client), + newGroupSyncer(ctx, c.client, c.skipDisabledUsers), } if !c.skipPages { - syncers = append(syncers, newPageSyncer(ctx, c.client)) + syncers = append(syncers, newPageSyncer(ctx, c.client, c.skipDisabledUsers)) } if !c.skipResources { - syncers = append(syncers, newResourceSyncer(ctx, c.client)) + syncers = append(syncers, newResourceSyncer(ctx, c.client, c.skipDisabledUsers)) } return syncers diff --git a/pkg/connector/groups.go b/pkg/connector/groups.go index 343784c6..8316049e 100644 --- a/pkg/connector/groups.go +++ b/pkg/connector/groups.go @@ -33,8 +33,9 @@ func memberEntitlementId(groupID *v2.ResourceId) string { } type groupSyncer struct { - resourceType *v2.ResourceType - client *client.Client + resourceType *v2.ResourceType + client *client.Client + skipDisabledUsers bool } func (s *groupSyncer) ResourceType(ctx context.Context) *v2.ResourceType { @@ -131,7 +132,7 @@ func (s *groupSyncer) Grants(ctx context.Context, resource *v2.Resource, pToken return nil, "", nil, err } - members, nextPageToken, err := s.client.ListGroupMembers(ctx, groupID, &client.Pager{Token: pToken.Token, Size: pToken.Size}) + members, nextPageToken, err := s.client.ListGroupMembers(ctx, groupID, &client.Pager{Token: pToken.Token, Size: pToken.Size}, s.skipDisabledUsers) if err != nil { return nil, "", nil, err } @@ -246,9 +247,10 @@ func (o *groupSyncer) Revoke(ctx context.Context, grant *v2.Grant) (annotations. return nil, nil } -func newGroupSyncer(ctx context.Context, c *client.Client) *groupSyncer { +func newGroupSyncer(ctx context.Context, c *client.Client, skipDisabledUsers bool) *groupSyncer { return &groupSyncer{ - resourceType: resourceTypeGroup, - client: c, + resourceType: resourceTypeGroup, + client: c, + skipDisabledUsers: skipDisabledUsers, } } diff --git a/pkg/connector/organizations.go b/pkg/connector/organizations.go index b5d3ea40..6d1c177b 100644 --- a/pkg/connector/organizations.go +++ b/pkg/connector/organizations.go @@ -20,10 +20,11 @@ var resourceTypeOrg = &v2.ResourceType{ } type orgSyncer struct { - resourceType *v2.ResourceType - client *client.Client - skipPages bool - skipResources bool + resourceType *v2.ResourceType + client *client.Client + skipPages bool + skipResources bool + skipDisabledUsers bool } func (s *orgSyncer) ResourceType(ctx context.Context) *v2.ResourceType { @@ -245,7 +246,7 @@ func (s *orgSyncer) Grants(ctx context.Context, resource *v2.Resource, pToken *p return nil, "", nil, err } - members, nextPageToken, err := s.client.ListGroupMembers(ctx, g.ID, &client.Pager{Token: bag.PageToken(), Size: pToken.Size}) + members, nextPageToken, err := s.client.ListGroupMembers(ctx, g.ID, &client.Pager{Token: bag.PageToken(), Size: pToken.Size}, s.skipDisabledUsers) if err != nil { return nil, "", nil, err } @@ -281,11 +282,12 @@ func (s *orgSyncer) Grants(ctx context.Context, resource *v2.Resource, pToken *p return ret, nextPageToken, nil, nil } -func newOrgSyncer(ctx context.Context, c *client.Client, skipPages bool, skipResources bool) *orgSyncer { +func newOrgSyncer(ctx context.Context, c *client.Client, skipPages bool, skipResources bool, skipDisabledUsers bool) *orgSyncer { return &orgSyncer{ - resourceType: resourceTypeOrg, - client: c, - skipPages: skipPages, - skipResources: skipResources, + resourceType: resourceTypeOrg, + client: c, + skipPages: skipPages, + skipResources: skipResources, + skipDisabledUsers: skipDisabledUsers, } } diff --git a/pkg/connector/pages.go b/pkg/connector/pages.go index a9699ba4..4cf35440 100644 --- a/pkg/connector/pages.go +++ b/pkg/connector/pages.go @@ -18,8 +18,9 @@ var resourceTypePage = &v2.ResourceType{ } type pageSyncer struct { - resourceType *v2.ResourceType - client *client.Client + resourceType *v2.ResourceType + client *client.Client + skipDisabledUsers bool } func (s *pageSyncer) ResourceType(ctx context.Context) *v2.ResourceType { @@ -163,7 +164,7 @@ func (s *pageSyncer) Grants(ctx context.Context, resource *v2.Resource, pToken * return nil, "", nil, err } - members, nextPageToken, err := s.client.ListGroupMembers(ctx, group.ID, &client.Pager{Token: bag.PageToken(), Size: pToken.Size}) + members, nextPageToken, err := s.client.ListGroupMembers(ctx, group.ID, &client.Pager{Token: bag.PageToken(), Size: pToken.Size}, s.skipDisabledUsers) if err != nil { return nil, "", nil, err } @@ -216,9 +217,10 @@ func (s *pageSyncer) Grants(ctx context.Context, resource *v2.Resource, pToken * return ret, nextPageToken, nil, nil } -func newPageSyncer(ctx context.Context, c *client.Client) *pageSyncer { +func newPageSyncer(ctx context.Context, c *client.Client, skipDisabledUsers bool) *pageSyncer { return &pageSyncer{ - resourceType: resourceTypePage, - client: c, + resourceType: resourceTypePage, + client: c, + skipDisabledUsers: skipDisabledUsers, } } diff --git a/pkg/connector/resources.go b/pkg/connector/resources.go index 13478e1a..d6f03e83 100644 --- a/pkg/connector/resources.go +++ b/pkg/connector/resources.go @@ -19,8 +19,9 @@ var resourceTypeResource = &v2.ResourceType{ } type resourceSyncer struct { - resourceType *v2.ResourceType - client *client.Client + resourceType *v2.ResourceType + client *client.Client + skipDisabledUsers bool } func (s *resourceSyncer) ResourceType(ctx context.Context) *v2.ResourceType { @@ -166,7 +167,7 @@ func (s *resourceSyncer) Grants(ctx context.Context, resource *v2.Resource, pTok return nil, "", nil, err } - members, nextPageToken, err := s.client.ListGroupMembers(ctx, group.ID, &client.Pager{Token: bag.PageToken(), Size: pToken.Size}) + members, nextPageToken, err := s.client.ListGroupMembers(ctx, group.ID, &client.Pager{Token: bag.PageToken(), Size: pToken.Size}, s.skipDisabledUsers) if err != nil { return nil, "", nil, err } @@ -219,9 +220,10 @@ func (s *resourceSyncer) Grants(ctx context.Context, resource *v2.Resource, pTok return ret, nextPageToken, nil, nil } -func newResourceSyncer(ctx context.Context, c *client.Client) *resourceSyncer { +func newResourceSyncer(ctx context.Context, c *client.Client, skipDisabledUsers bool) *resourceSyncer { return &resourceSyncer{ - resourceType: resourceTypeResource, - client: c, + resourceType: resourceTypeResource, + client: c, + skipDisabledUsers: skipDisabledUsers, } } From 9f5ff84da2ea257509a2b530ce23674add1f2cb6 Mon Sep 17 00:00:00 2001 From: Geoff Greer Date: Fri, 16 Feb 2024 15:40:12 -0800 Subject: [PATCH 3/5] Fix lint --- pkg/client/group.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/client/group.go b/pkg/client/group.go index 7e9bf2bc..82ebc498 100644 --- a/pkg/client/group.go +++ b/pkg/client/group.go @@ -167,7 +167,8 @@ func (c *Client) ListGroupMembers(ctx context.Context, groupID int64, pager *Pag sb := &strings.Builder{} if skipDisabledUsers { - _, _ = sb.WriteString(`select user_groups.id as id, "userId", "groupId", "isAdmin", users.enabled from user_groups INNER JOIN users ON users.id = "user_groups"."userId" WHERE "groupId"=$1 and users.enabled = true ORDER BY "id" `) + _, _ = sb.WriteString(`select user_groups.id as id, "userId", "groupId", "isAdmin", users.enabled from user_groups + INNER JOIN users ON users.id = "user_groups"."userId" WHERE "groupId"=$1 and users.enabled = true ORDER BY "id" `) } else { _, _ = sb.WriteString(`select "id", "userId", "groupId", "isAdmin" from user_groups WHERE "groupId"=$1 ORDER BY "id" `) } From 31d238a4912662d9db42452521d3e4adf8cedc65 Mon Sep 17 00:00:00 2001 From: Geoff Greer Date: Fri, 16 Feb 2024 15:41:51 -0800 Subject: [PATCH 4/5] Update baton-sdk to latest version. --- go.mod | 2 +- go.sum | 4 +-- .../baton-sdk/pkg/dotc1z/c1file.go | 35 +++++++++++++++++-- .../baton-sdk/pkg/dotc1z/sql_helpers.go | 2 +- vendor/modules.txt | 2 +- 5 files changed, 38 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index e965dd2d..2569906c 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/conductorone/baton-retool go 1.20 require ( - github.com/conductorone/baton-sdk v0.1.21 + github.com/conductorone/baton-sdk v0.1.22 github.com/georgysavva/scany v1.2.1 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/jackc/pgx/v4 v4.18.1 diff --git a/go.sum b/go.sum index c9adbdec..4448dcd1 100644 --- a/go.sum +++ b/go.sum @@ -55,8 +55,8 @@ github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/cockroach-go/v2 v2.2.0 h1:/5znzg5n373N/3ESjHF5SMLxiW4RKB05Ql//KWfeTFs= github.com/cockroachdb/cockroach-go/v2 v2.2.0/go.mod h1:u3MiKYGupPPjkn3ozknpMUpxPaNLTFWAya419/zv6eI= -github.com/conductorone/baton-sdk v0.1.21 h1:lFNAtBi/XUzhEfNMA/4LnvaVYbWHpy4PZz4kFMZMKDw= -github.com/conductorone/baton-sdk v0.1.21/go.mod h1:1VMycIep+HU8JXef2wenT3ECzx1w3Jr3KDQG+L6Mv30= +github.com/conductorone/baton-sdk v0.1.22 h1:9IX0q8oPVfuHyvXdLbxCRGgqhjp/SqGv8T1RbiM1Tps= +github.com/conductorone/baton-sdk v0.1.22/go.mod h1:1VMycIep+HU8JXef2wenT3ECzx1w3Jr3KDQG+L6Mv30= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/c1file.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/c1file.go index 36234d57..b33d1c34 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/c1file.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/c1file.go @@ -13,6 +13,11 @@ import ( v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" ) +type pragma struct { + name string + value string +} + type C1File struct { rawDb *sql.DB db *goqu.Database @@ -22,6 +27,7 @@ type C1File struct { dbFilePath string dbUpdated bool tempDir string + pragmas []pragma } type C1FOption func(*C1File) @@ -32,6 +38,12 @@ func WithC1FTmpDir(tempDir string) C1FOption { } } +func WithC1FPragma(name string, value string) C1FOption { + return func(o *C1File) { + o.pragmas = append(o.pragmas, pragma{name, value}) + } +} + // Returns a C1File instance for the given db filepath. func NewC1File(ctx context.Context, dbFilePath string, opts ...C1FOption) (*C1File, error) { rawDB, err := sql.Open("sqlite", dbFilePath) @@ -59,7 +71,8 @@ func NewC1File(ctx context.Context, dbFilePath string, opts ...C1FOption) (*C1Fi } type c1zOptions struct { - tmpDir string + tmpDir string + pragmas []pragma } type C1ZOption func(*c1zOptions) @@ -69,6 +82,12 @@ func WithTmpDir(tmpDir string) C1ZOption { } } +func WithPragma(name string, value string) C1ZOption { + return func(o *c1zOptions) { + o.pragmas = append(o.pragmas, pragma{name, value}) + } +} + // Returns a new C1File instance with its state stored at the provided filename. func NewC1ZFile(ctx context.Context, outputFilePath string, opts ...C1ZOption) (*C1File, error) { options := &c1zOptions{} @@ -81,7 +100,12 @@ func NewC1ZFile(ctx context.Context, outputFilePath string, opts ...C1ZOption) ( return nil, err } - c1File, err := NewC1File(ctx, dbFilePath) + var c1fopts []C1FOption + for _, pragma := range options.pragmas { + c1fopts = append(c1fopts, WithC1FPragma(pragma.name, pragma.value)) + } + + c1File, err := NewC1File(ctx, dbFilePath, c1fopts...) if err != nil { return nil, err } @@ -143,6 +167,13 @@ func (c *C1File) init(ctx context.Context) error { } } + for _, pragma := range c.pragmas { + _, err := c.db.ExecContext(ctx, fmt.Sprintf("PRAGMA %s = %s", pragma.name, pragma.value)) + if err != nil { + return err + } + } + return nil } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/sql_helpers.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/sql_helpers.go index b40ce01f..badcef02 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/sql_helpers.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/sql_helpers.go @@ -16,7 +16,7 @@ import ( v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" ) -const maxPageSize = 100 +const maxPageSize = 250 var allTableDescriptors = []tableDescriptor{ resourceTypes, diff --git a/vendor/modules.txt b/vendor/modules.txt index 9a664f04..912ec5f6 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -140,7 +140,7 @@ github.com/aws/smithy-go/waiter # github.com/benbjohnson/clock v1.3.5 ## explicit; go 1.15 github.com/benbjohnson/clock -# github.com/conductorone/baton-sdk v0.1.21 +# github.com/conductorone/baton-sdk v0.1.22 ## explicit; go 1.20 github.com/conductorone/baton-sdk/internal/connector github.com/conductorone/baton-sdk/pb/c1/c1z/v1 From 2a27cbf212563ed326d3d4d956952486583eb01e Mon Sep 17 00:00:00 2001 From: Geoff Greer Date: Fri, 16 Feb 2024 15:42:08 -0800 Subject: [PATCH 5/5] Increase max page size to speed up syncing a little more. --- pkg/client/pagination.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/client/pagination.go b/pkg/client/pagination.go index 06885dc2..097c47b7 100644 --- a/pkg/client/pagination.go +++ b/pkg/client/pagination.go @@ -5,7 +5,7 @@ import ( ) const ( - MaxPageSize = 100 + MaxPageSize = 250 MinPageSize = 10 )