Skip to content

Commit 0d6bc63

Browse files
fix: typo
1 parent 30d1960 commit 0d6bc63

3 files changed

Lines changed: 14 additions & 15 deletions

File tree

github/acc_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ func sweepUserSSHKeys(_ string) error {
298298
owner := meta.name
299299
ctx := context.Background()
300300

301-
keys, _, err := client.Users.ListSSHKeys(ctx, owner, nil)
301+
keys, _, err := client.Users.ListKeys(ctx, owner, nil)
302302
if err != nil {
303303
return err
304304
}
@@ -307,7 +307,7 @@ func sweepUserSSHKeys(_ string) error {
307307
if title := k.GetTitle(); strings.HasPrefix(title, testResourcePrefix) {
308308
fmt.Printf("destroying user SSH key %s\n", title)
309309

310-
if _, err := client.Users.DeleteSSHKey(ctx, k.GetID()); err != nil {
310+
if _, err := client.Users.DeleteKey(ctx, k.GetID()); err != nil {
311311
return err
312312
}
313313
}

github/resource_github_user_ssh_key.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ package github
22

33
import (
44
"context"
5-
"errors"
6-
"log"
5+
"fmt"
76
"net/http"
87
"strconv"
9-
"strings"
108

119
"github.com/google/go-github/v82/github"
10+
"github.com/hashicorp/terraform-plugin-log/tflog"
11+
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1212
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1313
)
1414

1515
func resourceGithubUserSshKey() *schema.Resource {
1616
return &schema.Resource{
17-
Create: resourceGithubUserSshKeyCreate,
18-
Read: resourceGithubUserSshKeyRead,
19-
Delete: resourceGithubUserSshKeyDelete,
17+
CreateContext: resourceGithubUserSshKeyCreate,
18+
ReadContext: resourceGithubUserSshKeyRead,
19+
DeleteContext: resourceGithubUserSshKeyDelete,
2020
Importer: &schema.ResourceImporter{
2121
StateContext: resourceGithubUserSshKeyImport,
2222
},
@@ -35,8 +35,8 @@ func resourceGithubUserSshKey() *schema.Resource {
3535
Description: "The public SSH key to add to your GitHub account.",
3636
},
3737
"key_id": {
38-
Type: schema.TypeInt,
39-
Computed: true,
38+
Type: schema.TypeInt,
39+
Computed: true,
4040
Description: "The unique identifier of the SSH key.",
4141
},
4242
"etag": {
@@ -83,7 +83,7 @@ func resourceGithubUserSshKeyRead(ctx context.Context, d *schema.ResourceData, m
8383
client := meta.(*Owner).v3client
8484

8585
keyID := d.Get("key_id").(int64)
86-
key, resp, err := client.Users.GetKey(ctx, keyID)
86+
_, _, err := client.Users.GetKey(ctx, keyID)
8787
if err != nil {
8888
if ghErr, ok := err.(*github.ErrorResponse); ok {
8989
if ghErr.Response.StatusCode == http.StatusNotModified {

github/resource_github_user_ssh_signing_key.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"fmt"
66
"net/http"
77
"strconv"
8-
"strings"
98

109
"github.com/google/go-github/v82/github"
1110
"github.com/hashicorp/terraform-plugin-log/tflog"
@@ -36,8 +35,8 @@ func resourceGithubUserSshSigningKey() *schema.Resource {
3635
Description: "The public SSH key to add to your GitHub account.",
3736
},
3837
"key_id": {
39-
Type: schema.TypeInt,
40-
Computed: true,
38+
Type: schema.TypeInt,
39+
Computed: true,
4140
Description: "The unique identifier of the SSH signing key.",
4241
},
4342
"etag": {
@@ -84,7 +83,7 @@ func resourceGithubUserSshSigningKeyRead(ctx context.Context, d *schema.Resource
8483
client := meta.(*Owner).v3client
8584

8685
keyID := d.Get("key_id").(int64)
87-
key, resp, err := client.Users.GetSSHSigningKey(ctx, keyID)
86+
_, _, err := client.Users.GetSSHSigningKey(ctx, keyID)
8887
if err != nil {
8988
if ghErr, ok := err.(*github.ErrorResponse); ok {
9089
if ghErr.Response.StatusCode == http.StatusNotModified {

0 commit comments

Comments
 (0)