Skip to content

Commit 4dec331

Browse files
committed
make public builder
1 parent 865b157 commit 4dec331

16 files changed

Lines changed: 26 additions & 26 deletions

pkg/connector/api_token.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func (o *apiTokenResourceType) List(
128128
}, nil
129129
}
130130

131-
func apiTokenBuilder(client *github.Client, orgCache *orgNameCache) *apiTokenResourceType {
131+
func APITokenBuilder(client *github.Client, orgCache *orgNameCache) *apiTokenResourceType {
132132
return &apiTokenResourceType{
133133
resourceType: resourceTypeApiToken,
134134
client: client,

pkg/connector/connector.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,26 +117,26 @@ type GitHub struct {
117117

118118
func (gh *GitHub) ResourceSyncers(ctx context.Context) []connectorbuilder.ResourceSyncerV2 {
119119
resourceSyncers := []connectorbuilder.ResourceSyncerV2{
120-
orgBuilder(gh.client, gh.appClient, gh.orgCache, gh.orgs, gh.syncSecrets),
121-
teamBuilder(gh.client, gh.orgCache, gh.directCollaboratorsOnly),
122-
userBuilder(gh.client, gh.graphqlClient, gh.orgCache, gh.orgs, gh.customClient, gh.enterprises),
123-
repositoryBuilder(gh.client, gh.orgCache, gh.omitArchivedRepositories, gh.directCollaboratorsOnly),
124-
orgRoleBuilder(gh.client, gh.orgCache),
125-
invitationBuilder(invitationBuilderParams{
120+
OrgBuilder(gh.client, gh.appClient, gh.orgCache, gh.orgs, gh.syncSecrets),
121+
TeamBuilder(gh.client, gh.orgCache, gh.directCollaboratorsOnly),
122+
UserBuilder(gh.client, gh.graphqlClient, gh.orgCache, gh.orgs, gh.customClient, gh.enterprises),
123+
RepositoryBuilder(gh.client, gh.orgCache, gh.omitArchivedRepositories, gh.directCollaboratorsOnly),
124+
OrgRoleBuilder(gh.client, gh.orgCache),
125+
InvitationBuilder(InvitationBuilderParams{
126126
client: gh.client,
127127
orgCache: gh.orgCache,
128128
orgs: gh.orgs,
129129
}),
130130
}
131131

132132
if gh.syncSecrets {
133-
resourceSyncers = append(resourceSyncers, apiTokenBuilder(gh.client, gh.orgCache))
133+
resourceSyncers = append(resourceSyncers, APITokenBuilder(gh.client, gh.orgCache))
134134
}
135135

136136
if len(gh.enterprises) > 0 {
137137
resourceSyncers = append(resourceSyncers,
138-
enterpriseRoleBuilder(gh.client, gh.appClient, gh.customClient, gh.enterprises),
139-
licenseBuilder(gh.customClient, gh.enterprises),
138+
EnterpriseRoleBuilder(gh.client, gh.appClient, gh.customClient, gh.enterprises),
139+
LicenseBuilder(gh.customClient, gh.enterprises),
140140
)
141141
}
142142
return resourceSyncers

pkg/connector/enterprise_role.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func (o *enterpriseRoleResourceType) Grants(
176176
return ret, &resourceSdk.SyncOpResults{}, nil
177177
}
178178

179-
func enterpriseRoleBuilder(client *github.Client, appClient *github.Client, customClient *customclient.Client, enterprises []string) *enterpriseRoleResourceType {
179+
func EnterpriseRoleBuilder(client *github.Client, appClient *github.Client, customClient *customclient.Client, enterprises []string) *enterpriseRoleResourceType {
180180
return &enterpriseRoleResourceType{
181181
resourceType: resourceTypeEnterpriseRole,
182182
client: client,

pkg/connector/invitation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,13 +520,13 @@ func containsLower(s, substr string) bool {
520520
return strings.Contains(strings.ToLower(s), substr)
521521
}
522522

523-
type invitationBuilderParams struct {
523+
type InvitationBuilderParams struct {
524524
client *github.Client
525525
orgCache *orgNameCache
526526
orgs []string
527527
}
528528

529-
func invitationBuilder(p invitationBuilderParams) *invitationResourceType {
529+
func InvitationBuilder(p InvitationBuilderParams) *invitationResourceType {
530530
return &invitationResourceType{
531531
client: p.client,
532532
orgCache: p.orgCache,

pkg/connector/invitation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func TestInvitationListPagination(t *testing.T) {
154154

155155
newBuilder := func(httpClient *http.Client) *invitationResourceType {
156156
gh := github.NewClient(httpClient)
157-
return invitationBuilder(invitationBuilderParams{
157+
return InvitationBuilder(InvitationBuilderParams{
158158
client: gh,
159159
orgCache: newOrgNameCache(gh),
160160
orgs: []string{invitationTestOrgLogin},

pkg/connector/license.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func licenseResource(enterprise string, purchasedSeats, consumedSeats int64, ent
162162
)
163163
}
164164

165-
func licenseBuilder(
165+
func LicenseBuilder(
166166
customClient *customclient.Client,
167167
enterprises []string,
168168
) *licenseResourceType {

pkg/connector/org.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ func (o *orgResourceType) Revoke(ctx context.Context, grant *v2.Grant) (annotati
418418
return nil, nil
419419
}
420420

421-
func orgBuilder(client, appClient *github.Client, orgCache *orgNameCache, orgs []string, syncSecrets bool) *orgResourceType {
421+
func OrgBuilder(client, appClient *github.Client, orgCache *orgNameCache, orgs []string, syncSecrets bool) *orgResourceType {
422422
orgMap := make(map[string]struct{})
423423

424424
for _, o := range orgs {

pkg/connector/org_role.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ func (o *orgRoleResourceType) Revoke(ctx context.Context, grant *v2.Grant) (anno
445445
return nil, nil
446446
}
447447

448-
func orgRoleBuilder(client *github.Client, orgCache *orgNameCache) *orgRoleResourceType {
448+
func OrgRoleBuilder(client *github.Client, orgCache *orgNameCache) *orgRoleResourceType {
449449
return &orgRoleResourceType{
450450
resourceType: resourceTypeOrgRole,
451451
client: client,

pkg/connector/org_role_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func TestOrgRole(t *testing.T) {
2525

2626
githubClient := github.NewClient(mgh.Server())
2727
cache := newOrgNameCache(githubClient)
28-
client := orgRoleBuilder(githubClient, cache)
28+
client := OrgRoleBuilder(githubClient, cache)
2929

3030
organization, _ := organizationResource(ctx, githubOrganization, nil, true)
3131
roleResource, _ := orgRoleResource(ctx, &OrganizationRole{
@@ -93,7 +93,7 @@ func TestOrgRole(t *testing.T) {
9393

9494
githubClient := github.NewClient(mockGithub.Server())
9595
cache := newOrgNameCache(githubClient)
96-
client := orgRoleBuilder(githubClient, cache)
96+
client := OrgRoleBuilder(githubClient, cache)
9797

9898
organization, _ := organizationResource(ctx, githubOrganization, nil, true)
9999

pkg/connector/org_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestOrganization(t *testing.T) {
2424

2525
githubClient := github.NewClient(mgh.Server())
2626
cache := newOrgNameCache(githubClient)
27-
client := orgBuilder(githubClient, nil, cache, nil, false)
27+
client := OrgBuilder(githubClient, nil, cache, nil, false)
2828

2929
organization, _ := organizationResource(ctx, githubOrganization, nil, false)
3030
user, _ := userResource(ctx, githubUser, *githubUser.Email, nil)

0 commit comments

Comments
 (0)