MCPcopy Create free account
hub / github.com/cli/cli / getSSHKey

Function getSSHKey

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

Source from the content-addressed store, hash-verified

23}
24
25func 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}

Callers 2

deleteRunFunction · 0.85
TestGetSSHKeyHTTPErrorFunction · 0.85

Calls 4

JoinPathFunction · 0.92
NewClientFromHTTPFunction · 0.92
RESTMethod · 0.65
StringMethod · 0.65

Tested by 1

TestGetSSHKeyHTTPErrorFunction · 0.68