Skip to content

Commit

Permalink
Update client usage to restClient
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickmarabeas committed Jan 29, 2020
1 parent 188bf85 commit 18c5f59
Show file tree
Hide file tree
Showing 42 changed files with 111 additions and 111 deletions.
2 changes: 1 addition & 1 deletion github/data_source_github_collaborators.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func dataSourceGithubCollaborators() *schema.Resource {

func dataSourceGithubCollaboratorsRead(d *schema.ResourceData, meta interface{}) error {

client := meta.(*Organization).client
client := meta.(*Organization).restClient
ctx := context.Background()

owner := d.Get("owner").(string)
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_ip_ranges.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func dataSourceGithubIpRanges() *schema.Resource {
func dataSourceGithubIpRangesRead(d *schema.ResourceData, meta interface{}) error {
org := meta.(*Organization)

api, _, err := org.client.APIMeta(org.StopContext)
api, _, err := org.restClient.APIMeta(org.StopContext)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func dataSourceGithubRepositoriesRead(d *schema.ResourceData, meta interface{})
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient

query := d.Get("query").(string)
opt := &github.SearchOptions{
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func dataSourceGithubRepositoryRead(d *schema.ResourceData, meta interface{}) er
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient
orgName := meta.(*Organization).name
var repoName string

Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_team.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func dataSourceGithubTeamRead(d *schema.ResourceData, meta interface{}) error {
slug := d.Get("slug").(string)
log.Printf("[INFO] Refreshing GitHub Team: %s", slug)

client := meta.(*Organization).client
client := meta.(*Organization).restClient
ctx := context.Background()

team, err := getGithubTeamBySlug(ctx, client, meta.(*Organization).name, slug)
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func dataSourceGithubUserRead(d *schema.ResourceData, meta interface{}) error {
username := d.Get("username").(string)
log.Printf("[INFO] Refreshing GitHub User: %s", username)

client := meta.(*Organization).client
client := meta.(*Organization).restClient
ctx := context.Background()

user, _, err := client.Users.Get(ctx, username)
Expand Down
12 changes: 6 additions & 6 deletions github/resource_github_branch_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func resourceGithubBranchProtectionCreate(d *schema.ResourceData, meta interface
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient

orgName := meta.(*Organization).name
repoName := d.Get("repository").(string)
Expand Down Expand Up @@ -193,7 +193,7 @@ func resourceGithubBranchProtectionRead(d *schema.ResourceData, meta interface{}
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient

repoName, branch, err := parseTwoPartID(d.Id())
if err != nil {
Expand Down Expand Up @@ -259,7 +259,7 @@ func resourceGithubBranchProtectionUpdate(d *schema.ResourceData, meta interface
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient
repoName, branch, err := parseTwoPartID(d.Id())
if err != nil {
return err
Expand Down Expand Up @@ -315,7 +315,7 @@ func resourceGithubBranchProtectionDelete(d *schema.ResourceData, meta interface
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient
repoName, branch, err := parseTwoPartID(d.Id())
if err != nil {
return err
Expand Down Expand Up @@ -376,7 +376,7 @@ func flattenAndSetRequiredStatusChecks(d *schema.ResourceData, protection *githu
}

func requireSignedCommitsRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*Organization).client
client := meta.(*Organization).restClient

repoName, branch, err := parseTwoPartID(d.Id())
if err != nil {
Expand All @@ -402,7 +402,7 @@ func requireSignedCommitsRead(d *schema.ResourceData, meta interface{}) error {

func requireSignedCommitsUpdate(d *schema.ResourceData, meta interface{}) (err error) {
requiredSignedCommit := d.Get("require_signed_commits").(bool)
client := meta.(*Organization).client
client := meta.(*Organization).restClient

repoName, branch, err := parseTwoPartID(d.Id())
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions github/resource_github_branch_protection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func testAccCheckGithubProtectedBranchExists(n, id string, protection *github.Pr
return fmt.Errorf("Expected ID to be %v, got %v", id, rs.Primary.ID)
}

conn := testAccProvider.Meta().(*Organization).client
conn := testAccProvider.Meta().(*Organization).restClient
o := testAccProvider.Meta().(*Organization).name
r, b, err := parseTwoPartID(rs.Primary.ID)
if err != nil {
Expand Down Expand Up @@ -360,7 +360,7 @@ func testAccCheckGithubBranchProtectionNoPullRequestReviewsExist(protection *git
}

func testAccGithubBranchProtectionDestroy(s *terraform.State) error {
conn := testAccProvider.Meta().(*Organization).client
conn := testAccProvider.Meta().(*Organization).restClient

for _, rs := range s.RootModule().Resources {
if rs.Type != "github_branch_protection" {
Expand Down
6 changes: 3 additions & 3 deletions github/resource_github_issue_label.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func resourceGithubIssueLabelCreateOrUpdate(d *schema.ResourceData, meta interfa
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient
orgName := meta.(*Organization).name
repoName := d.Get("repository").(string)
name := d.Get("name").(string)
Expand Down Expand Up @@ -140,7 +140,7 @@ func resourceGithubIssueLabelRead(d *schema.ResourceData, meta interface{}) erro
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient
repoName, name, err := parseTwoPartID(d.Id())
if err != nil {
return err
Expand Down Expand Up @@ -186,7 +186,7 @@ func resourceGithubIssueLabelDelete(d *schema.ResourceData, meta interface{}) er
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient

orgName := meta.(*Organization).name
repoName := d.Get("repository").(string)
Expand Down
4 changes: 2 additions & 2 deletions github/resource_github_issue_label_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func testAccCheckGithubIssueLabelExists(n string, label *github.Label) resource.
return fmt.Errorf("No issue label ID is set")
}

conn := testAccProvider.Meta().(*Organization).client
conn := testAccProvider.Meta().(*Organization).restClient
orgName := testAccProvider.Meta().(*Organization).name
repoName, name, err := parseTwoPartID(rs.Primary.ID)
if err != nil {
Expand Down Expand Up @@ -169,7 +169,7 @@ func testAccCheckGithubIssueLabelAttributes(label *github.Label, name, color str
}

func testAccGithubIssueLabelDestroy(s *terraform.State) error {
conn := testAccProvider.Meta().(*Organization).client
conn := testAccProvider.Meta().(*Organization).restClient

for _, rs := range s.RootModule().Resources {
if rs.Type != "github_issue_label" {
Expand Down
6 changes: 3 additions & 3 deletions github/resource_github_membership.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func resourceGithubMembershipCreateOrUpdate(d *schema.ResourceData, meta interfa
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient

orgName := meta.(*Organization).name
username := d.Get("username").(string)
Expand Down Expand Up @@ -79,7 +79,7 @@ func resourceGithubMembershipRead(d *schema.ResourceData, meta interface{}) erro
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient

orgName := meta.(*Organization).name
_, username, err := parseTwoPartID(d.Id())
Expand Down Expand Up @@ -122,7 +122,7 @@ func resourceGithubMembershipDelete(d *schema.ResourceData, meta interface{}) er
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient
orgName := meta.(*Organization).name
ctx := context.WithValue(context.Background(), ctxId, d.Id())

Expand Down
6 changes: 3 additions & 3 deletions github/resource_github_membership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestAccGithubMembership_caseInsensitive(t *testing.T) {
}

func testAccCheckGithubMembershipDestroy(s *terraform.State) error {
conn := testAccProvider.Meta().(*Organization).client
conn := testAccProvider.Meta().(*Organization).restClient

for _, rs := range s.RootModule().Resources {
if rs.Type != "github_membership" {
Expand Down Expand Up @@ -122,7 +122,7 @@ func testAccCheckGithubMembershipExists(n string, membership *github.Membership)
return fmt.Errorf("No membership ID is set")
}

conn := testAccProvider.Meta().(*Organization).client
conn := testAccProvider.Meta().(*Organization).restClient
orgName, username, err := parseTwoPartID(rs.Primary.ID)
if err != nil {
return err
Expand All @@ -148,7 +148,7 @@ func testAccCheckGithubMembershipRoleState(n string, membership *github.Membersh
return fmt.Errorf("No membership ID is set")
}

conn := testAccProvider.Meta().(*Organization).client
conn := testAccProvider.Meta().(*Organization).restClient
orgName, username, err := parseTwoPartID(rs.Primary.ID)
if err != nil {
return err
Expand Down
8 changes: 4 additions & 4 deletions github/resource_github_organization_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func resourceGithubOrganizationProjectCreate(d *schema.ResourceData, meta interf
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient
orgName := meta.(*Organization).name
name := d.Get("name").(string)
body := d.Get("body").(string)
Expand Down Expand Up @@ -76,7 +76,7 @@ func resourceGithubOrganizationProjectRead(d *schema.ResourceData, meta interfac
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient
orgName := meta.(*Organization).name

projectID, err := strconv.ParseInt(d.Id(), 10, 64)
Expand Down Expand Up @@ -120,7 +120,7 @@ func resourceGithubOrganizationProjectUpdate(d *schema.ResourceData, meta interf
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient
orgName := meta.(*Organization).name

name := d.Get("name").(string)
Expand Down Expand Up @@ -151,7 +151,7 @@ func resourceGithubOrganizationProjectDelete(d *schema.ResourceData, meta interf
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient
orgName := meta.(*Organization).name
projectID, err := strconv.ParseInt(d.Id(), 10, 64)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions github/resource_github_organization_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestAccGithubOrganizationProject_basic(t *testing.T) {
}

func testAccGithubOrganizationProjectDestroy(s *terraform.State) error {
conn := testAccProvider.Meta().(*Organization).client
conn := testAccProvider.Meta().(*Organization).restClient

for _, rs := range s.RootModule().Resources {
if rs.Type != "github_organization_project" {
Expand Down Expand Up @@ -81,7 +81,7 @@ func testAccCheckGithubOrganizationProjectExists(n string, project *github.Proje
return err
}

conn := testAccProvider.Meta().(*Organization).client
conn := testAccProvider.Meta().(*Organization).restClient
gotProject, _, err := conn.Projects.GetProject(context.TODO(), projectID)
if err != nil {
return err
Expand Down
8 changes: 4 additions & 4 deletions github/resource_github_organization_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func resourceGithubOrganizationWebhookCreate(d *schema.ResourceData, meta interf
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient

orgName := meta.(*Organization).name
webhookObj := resourceGithubOrganizationWebhookObject(d)
Expand Down Expand Up @@ -109,7 +109,7 @@ func resourceGithubOrganizationWebhookRead(d *schema.ResourceData, meta interfac
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient

orgName := meta.(*Organization).name
hookID, err := strconv.ParseInt(d.Id(), 10, 64)
Expand Down Expand Up @@ -166,7 +166,7 @@ func resourceGithubOrganizationWebhookUpdate(d *schema.ResourceData, meta interf
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient

orgName := meta.(*Organization).name
webhookObj := resourceGithubOrganizationWebhookObject(d)
Expand All @@ -193,7 +193,7 @@ func resourceGithubOrganizationWebhookDelete(d *schema.ResourceData, meta interf
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient

orgName := meta.(*Organization).name
hookID, err := strconv.ParseInt(d.Id(), 10, 64)
Expand Down
4 changes: 2 additions & 2 deletions github/resource_github_organization_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func testAccCheckGithubOrganizationWebhookExists(n string, hook *github.Hook) re
}

org := testAccProvider.Meta().(*Organization)
conn := org.client
conn := org.restClient
getHook, _, err := conn.Organizations.GetHook(context.TODO(), org.name, hookID)
if err != nil {
return err
Expand Down Expand Up @@ -144,7 +144,7 @@ func testAccCheckGithubOrganizationWebhookSecret(r, secret string) resource.Test
}

func testAccCheckGithubOrganizationWebhookDestroy(s *terraform.State) error {
conn := testAccProvider.Meta().(*Organization).client
conn := testAccProvider.Meta().(*Organization).restClient
orgName := testAccProvider.Meta().(*Organization).name

for _, rs := range s.RootModule().Resources {
Expand Down
8 changes: 4 additions & 4 deletions github/resource_github_project_column.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func resourceGithubProjectColumnCreate(d *schema.ResourceData, meta interface{})
return err
}

client := meta.(*Organization).client
client := meta.(*Organization).restClient

options := github.ProjectColumnOptions{
Name: d.Get("name").(string),
Expand Down Expand Up @@ -73,7 +73,7 @@ func resourceGithubProjectColumnCreate(d *schema.ResourceData, meta interface{})
}

func resourceGithubProjectColumnRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*Organization).client
client := meta.(*Organization).restClient

columnID, err := strconv.ParseInt(d.Id(), 10, 64)
if err != nil {
Expand Down Expand Up @@ -106,7 +106,7 @@ func resourceGithubProjectColumnRead(d *schema.ResourceData, meta interface{}) e
}

func resourceGithubProjectColumnUpdate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*Organization).client
client := meta.(*Organization).restClient

options := github.ProjectColumnOptions{
Name: d.Get("name").(string),
Expand All @@ -128,7 +128,7 @@ func resourceGithubProjectColumnUpdate(d *schema.ResourceData, meta interface{})
}

func resourceGithubProjectColumnDelete(d *schema.ResourceData, meta interface{}) error {
client := meta.(*Organization).client
client := meta.(*Organization).restClient

columnID, err := strconv.ParseInt(d.Id(), 10, 64)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions github/resource_github_project_column_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestAccGithubProjectColumn_basic(t *testing.T) {
}

func testAccGithubProjectColumnDestroy(s *terraform.State) error {
conn := testAccProvider.Meta().(*Organization).client
conn := testAccProvider.Meta().(*Organization).restClient

for _, rs := range s.RootModule().Resources {
if rs.Type != "github_project_column" {
Expand Down Expand Up @@ -87,7 +87,7 @@ func testAccCheckGithubProjectColumnExists(n string, project *github.ProjectColu
return err
}

conn := testAccProvider.Meta().(*Organization).client
conn := testAccProvider.Meta().(*Organization).restClient
gotColumn, _, err := conn.Projects.GetProjectColumn(context.TODO(), columnID)
if err != nil {
return err
Expand Down
Loading

0 comments on commit 18c5f59

Please sign in to comment.