(httpClient *http.Client, host string, keyID string)
| 15 | } |
| 16 | |
| 17 | func deleteSSHKey(httpClient *http.Client, host string, keyID string) error { |
| 18 | url := fmt.Sprintf("%suser/keys/%s", ghinstance.RESTPrefix(host), keyID) |
| 19 | req, err := http.NewRequest("DELETE", url, nil) |
| 20 | if err != nil { |
| 21 | return err |
| 22 | } |
| 23 | |
| 24 | resp, err := httpClient.Do(req) |
| 25 | if err != nil { |
| 26 | return err |
| 27 | } |
| 28 | defer resp.Body.Close() |
| 29 | |
| 30 | if resp.StatusCode > 299 { |
| 31 | return api.HandleHTTPError(resp) |
| 32 | } |
| 33 | |
| 34 | return nil |
| 35 | } |
| 36 | |
| 37 | func getSSHKey(httpClient *http.Client, host string, keyID string) (*sshKey, error) { |
| 38 | url := fmt.Sprintf("%suser/keys/%s", ghinstance.RESTPrefix(host), keyID) |
no test coverage detected