MCPcopy Index your code
hub / github.com/cli/cli / deleteSSHKey

Function deleteSSHKey

pkg/cmd/ssh-key/delete/http.go:17–35  ·  view source on GitHub ↗
(httpClient *http.Client, host string, keyID string)

Source from the content-addressed store, hash-verified

15}
16
17func 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
37func getSSHKey(httpClient *http.Client, host string, keyID string) (*sshKey, error) {
38 url := fmt.Sprintf("%suser/keys/%s", ghinstance.RESTPrefix(host), keyID)

Callers 1

deleteRunFunction · 0.85

Calls 4

RESTPrefixFunction · 0.92
HandleHTTPErrorFunction · 0.92
DoMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected