(s *schema.Schema)
| 179 | } |
| 180 | |
| 181 | func (gohanClientCLI *GohanClientCLI) getDeleteCommand(s *schema.Schema) gohanCommand { |
| 182 | return gohanCommand{ |
| 183 | Name: fmt.Sprintf("%s delete", s.ID), |
| 184 | Schema: s, |
| 185 | Action: func(args []string) (string, error) { |
| 186 | if len(args) < 1 { |
| 187 | return "", fmt.Errorf("Wrong number of arguments") |
| 188 | } |
| 189 | _, err := gohanClientCLI.handleArguments(args[:len(args)-1], s) |
| 190 | if err != nil { |
| 191 | return "", err |
| 192 | } |
| 193 | id, err := gohanClientCLI.getResourceID(s, args[len(args)-1]) |
| 194 | if err != nil { |
| 195 | return "", err |
| 196 | } |
| 197 | url := fmt.Sprintf("%s%s/%s", gohanClientCLI.opts.gohanEndpointURL, s.URL, id) |
| 198 | result, err := gohanClientCLI.request("DELETE", url, nil) |
| 199 | return gohanClientCLI.formatOutput(s, result), err |
| 200 | }, |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | // Assumes gohan client is called as follows: |
| 205 | // gohan client [common_params...] [action_input] [resource_id] |
no test coverage detected