Skip to content

Commit fe7eb04

Browse files
committed
Review fixes
1 parent 0e01983 commit fe7eb04

File tree

8 files changed

+28
-14
lines changed

8 files changed

+28
-14
lines changed

pkg/api/cloud/image/response.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package image
33
import "github.com/sitehostnz/gosh/pkg/models"
44

55
type (
6-
// ListResponse represents the return from the /cloud/images/list_all.json endpoint.
6+
// ListResponse represents the return from the /cloud/stack/image/list_all.json endpoint.
77
ListResponse struct {
88
Return struct {
99
models.Pagination

pkg/api/cloud/ssh/user/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/sitehostnz/gosh/pkg/utils"
88
)
99

10-
// Delete deletes a cloud database.
10+
// Delete an existing SSH user.
1111
func (s *Client) Delete(ctx context.Context, request DeleteRequest) (response DeleteResponse, err error) {
1212
uri := "cloud/ssh/user/delete.json"
1313
keys := []string{

pkg/api/cloud/ssh/user/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/sitehostnz/gosh/pkg/utils"
77
)
88

9-
// List returns a list of stack images, specific to the customer.
9+
// List a list of all SSH users.
1010
func (s *Client) List(ctx context.Context, options ListOptions) (response ListResponse, err error) {
1111
uri := "cloud/ssh/user/list_all.json"
1212

pkg/api/cloud/stack/image/response.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,4 @@ type (
88
Return []models.StackImage `json:"return"`
99
models.APIResponse
1010
}
11-
12-
// GetResponse returns a single image from the /cloud/stack/images/get.json endpoint.
13-
GetResponse struct{}
1411
)

pkg/api/dns/recordget.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,23 @@ func (s *Client) GetRecordWithType(ctx context.Context, request RecordRequest) (
3838
}
3939
return filteredRecords, nil
4040
}
41+
42+
// GetRecordWithRecord is a special case, for mainly when we are creating records where we need to get back what we just created.
43+
//
44+
// Deprecated: This is only needed for older versions of the Terraform provider as we now get a record ID back.
45+
func (s *Client) GetRecordWithRecord(ctx context.Context, request models.DNSRecord) (response models.DNSRecord, err error) {
46+
records, err := s.ListRecords(ctx, ListRecordsRequest{Domain: request.Domain})
47+
if err != nil {
48+
return response, err
49+
}
50+
51+
for _, r := range records.Return {
52+
if r.Name == request.Name &&
53+
r.Type == request.Type &&
54+
r.Content == request.Content &&
55+
(r.Priority == request.Priority || r.Priority == "0") {
56+
return r, nil
57+
}
58+
}
59+
return response, nil
60+
}

pkg/api/ssh/key/response.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package key
33
import "github.com/sitehostnz/gosh/pkg/models"
44

55
type (
6-
// ListResponse represents the listing of SSHKeys.
6+
// ListResponse represents the listing of SSH keys.
77
ListResponse struct {
88
Return struct {
99
models.Pagination
@@ -12,7 +12,7 @@ type (
1212
models.APIResponse
1313
}
1414

15-
// CreateResponse represents a result of the create an SSH Key call.
15+
// CreateResponse represents a result of creating an SSH key.
1616
CreateResponse struct {
1717
Return struct {
1818
KeyID string `json:"key_id"`
@@ -26,12 +26,12 @@ type (
2626
models.APIResponse
2727
}
2828

29-
// DeleteResponse represents a result of a delete an SSH Key call.
29+
// DeleteResponse represents the result of deleting an SSH key.
3030
DeleteResponse struct {
3131
models.APIResponse
3232
}
3333

34-
// UpdateResponse represents a result of the update an SSH Key call.
34+
// UpdateResponse represents a result of updating an SSH key.
3535
UpdateResponse struct {
3636
models.APIResponse
3737
}

pkg/models/job.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package models
22

33
type (
4-
54
// JobDetails represents the job information.
65
JobDetails struct {
76
Created string `json:"created"`

pkg/utils/utils.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ func Encode(v url.Values, keys []string) string {
2727
buf.WriteString(url.QueryEscape(v))
2828
}
2929
}
30-
s := buf.String()
31-
32-
return s
30+
return buf.String()
3331
}
3432

3533
// AddOptions adds the options to the URL.

0 commit comments

Comments
 (0)