| 23 | } |
| 24 | |
| 25 | func getSSHKey(httpClient *http.Client, host string, keyID string) (*sshKey, error) { |
| 26 | var key sshKey |
| 27 | path, err := safeurl.JoinPath("user", "keys", keyID) |
| 28 | if err != nil { |
| 29 | return nil, err |
| 30 | } |
| 31 | // TODO(api-client-rollout) |
| 32 | // This line of code is part of a mechanical roll out of the api client. |
| 33 | // As a follow up, consider whether the api client can be injected to this call site, rather than constructed |
| 34 | err = api.NewClientFromHTTP(httpClient).REST(host, http.MethodGet, path.String(), nil, &key) |
| 35 | if err != nil { |
| 36 | return nil, err |
| 37 | } |
| 38 | |
| 39 | return &key, nil |
| 40 | } |