MCPcopy
hub / github.com/digitalocean/doctl / RunKeyUpdate

Function RunKeyUpdate

commands/sshkeys.go:203–229  ·  view source on GitHub ↗

RunKeyUpdate updates a key.

(c *CmdConfig)

Source from the content-addressed store, hash-verified

201
202// RunKeyUpdate updates a key.
203func RunKeyUpdate(c *CmdConfig) error {
204 ks := c.Keys()
205
206 err := ensureOneArg(c)
207 if err != nil {
208 return err
209 }
210
211 rawKey := c.Args[0]
212
213 name, err := c.Doit.GetString(c.NS, doctl.ArgKeyName)
214 if err != nil {
215 return err
216 }
217
218 req := &godo.KeyUpdateRequest{
219 Name: name,
220 }
221
222 k, err := ks.Update(rawKey, req)
223 if err != nil {
224 return err
225 }
226
227 item := &displayers.Key{Keys: do.SSHKeys{*k}}
228 return c.Display(item)
229}

Callers 2

TestKeysUpdateByIDFunction · 0.85

Calls 4

ensureOneArgFunction · 0.85
GetStringMethod · 0.65
UpdateMethod · 0.65
DisplayMethod · 0.45

Tested by 2

TestKeysUpdateByIDFunction · 0.68