// TakeOwnershipAction takes the ownership of an alert at OpsGenie. func TakeOwnershipAction(c *gcli.Context) { cli, err := NewAlertClient(c) if err != nil { os.Exit(1) } req := alerts.TakeOwnershipAlertRequest{} if val, success := getVal("id", c); success { req.ID = val } if val, success := getVal("alias", c); success { req.Alias = val } req.User = grabUsername(c) if val, success := getVal("source", c); success { req.Source = val } if val, success := getVal("note", c); success { req.Note = val } printVerboseMessage("Take ownership request prepared from flags, sending request to OpsGenie..") _, err = cli.TakeOwnership(req) if err != nil { fmt.Printf("%s\n", err.Error()) os.Exit(1) } printVerboseMessage("Ownership taken successfully.") }