Skip to content

Commit dd6d4bb

Browse files
committed
fix: update go-github import to v84 and remove duplicate team helpers after rebase
1 parent 7c39d61 commit dd6d4bb

8 files changed

Lines changed: 7 additions & 62 deletions

github/data_source_github_enterprise_cost_centers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package github
33
import (
44
"context"
55

6-
"github.com/google/go-github/v83/github"
6+
"github.com/google/go-github/v84/github"
77
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
88
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
99
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

github/resource_github_enterprise_cost_center.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"fmt"
66

7-
"github.com/google/go-github/v83/github"
7+
"github.com/google/go-github/v84/github"
88
"github.com/hashicorp/terraform-plugin-log/tflog"
99
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1010
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

github/resource_github_enterprise_cost_center_organizations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"fmt"
66

7-
"github.com/google/go-github/v83/github"
7+
"github.com/google/go-github/v84/github"
88
"github.com/hashicorp/terraform-plugin-log/tflog"
99
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1010
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

github/resource_github_enterprise_cost_center_repositories.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"fmt"
66

7-
"github.com/google/go-github/v83/github"
7+
"github.com/google/go-github/v84/github"
88
"github.com/hashicorp/terraform-plugin-log/tflog"
99
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1010
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

github/resource_github_enterprise_cost_center_users.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"fmt"
66

7-
"github.com/google/go-github/v83/github"
7+
"github.com/google/go-github/v84/github"
88
"github.com/hashicorp/terraform-plugin-log/tflog"
99
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1010
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

github/util.go

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -213,61 +213,6 @@ func (e *unconvertibleIdError) Error() string {
213213
e.OriginalId, e.OriginalError.Error())
214214
}
215215

216-
func getTeamID(teamIDString string, meta any) (int64, error) {
217-
// Given a string that is either a team id or team slug, return the
218-
// id of the team it is referring to.
219-
ctx := context.Background()
220-
client := meta.(*Owner).v3client
221-
orgName := meta.(*Owner).name
222-
223-
teamId, parseIntErr := strconv.ParseInt(teamIDString, 10, 64)
224-
if parseIntErr == nil {
225-
return teamId, nil
226-
}
227-
228-
// The given id not an integer, assume it is a team slug
229-
team, _, slugErr := client.Teams.GetTeamBySlug(ctx, orgName, teamIDString)
230-
if slugErr != nil {
231-
return -1, errors.New(parseIntErr.Error() + slugErr.Error())
232-
}
233-
return team.GetID(), nil
234-
}
235-
236-
func getTeamSlug(teamIDString string, meta any) (string, error) {
237-
ctx := context.Background()
238-
return getTeamSlugContext(ctx, teamIDString, meta)
239-
}
240-
241-
func getTeamSlugContext(ctx context.Context, teamIDString string, meta any) (string, error) {
242-
// Given a string that is either a team id or team slug, return the
243-
// team slug it is referring to.
244-
client := meta.(*Owner).v3client
245-
orgName := meta.(*Owner).name
246-
orgId := meta.(*Owner).id
247-
248-
teamId, parseIntErr := strconv.ParseInt(teamIDString, 10, 64)
249-
if parseIntErr != nil {
250-
// The given id not an integer, assume it is a team slug
251-
team, _, slugErr := client.Teams.GetTeamBySlug(ctx, orgName, teamIDString)
252-
if slugErr != nil {
253-
return "", errors.New(parseIntErr.Error() + slugErr.Error())
254-
}
255-
return team.GetSlug(), nil
256-
}
257-
258-
// The given id is an integer, assume it is a team id
259-
team, _, teamIdErr := client.Teams.GetTeamByID(ctx, orgId, teamId)
260-
if teamIdErr != nil {
261-
// There isn't a team with the given ID, assume it is a teamslug
262-
team, _, slugErr := client.Teams.GetTeamBySlug(ctx, orgName, teamIDString)
263-
if slugErr != nil {
264-
return "", errors.New(teamIdErr.Error() + slugErr.Error())
265-
}
266-
return team.GetSlug(), nil
267-
}
268-
return team.GetSlug(), nil
269-
}
270-
271216
// errIs404 checks if the error is a GitHub 404 Not Found response.
272217
func errIs404(err error) bool {
273218
var ghErr *github.ErrorResponse

github/util_enterprise_cost_center.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"time"
66

7-
"github.com/google/go-github/v83/github"
7+
"github.com/google/go-github/v84/github"
88
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
99
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
1010
)

github/util_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"testing"
77
"unicode"
88

9-
"github.com/google/go-github/v83/github"
9+
"github.com/google/go-github/v84/github"
1010
"github.com/hashicorp/go-cty/cty"
1111
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1212
)

0 commit comments

Comments
 (0)