(s *schema.Schema)
| 148 | } |
| 149 | |
| 150 | func (gohanClientCLI *GohanClientCLI) getPutCommand(s *schema.Schema) gohanCommand { |
| 151 | return gohanCommand{ |
| 152 | Name: fmt.Sprintf("%s set", s.ID), |
| 153 | Schema: s, |
| 154 | Action: func(args []string) (string, error) { |
| 155 | if len(args) < 1 { |
| 156 | return "", fmt.Errorf("Wrong number of arguments") |
| 157 | } |
| 158 | argsMap, err := gohanClientCLI.handleArguments(args[:len(args)-1], s) |
| 159 | if err != nil { |
| 160 | return "", err |
| 161 | } |
| 162 | parsedArgs, err := gohanClientCLI.handleRelationArguments(s, argsMap) |
| 163 | if err != nil { |
| 164 | return "", err |
| 165 | } |
| 166 | opts := gophercloud.RequestOpts{ |
| 167 | JSONBody: parsedArgs, |
| 168 | OkCodes: []int{200, 201, 202, 400}, |
| 169 | } |
| 170 | id, err := gohanClientCLI.getResourceID(s, args[len(args)-1]) |
| 171 | if err != nil { |
| 172 | return "", err |
| 173 | } |
| 174 | url := fmt.Sprintf("%s%s/%s", gohanClientCLI.opts.gohanEndpointURL, s.URL, id) |
| 175 | result, err := gohanClientCLI.request("PUT", url, &opts) |
| 176 | return gohanClientCLI.formatOutput(s, result), err |
| 177 | }, |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | func (gohanClientCLI *GohanClientCLI) getDeleteCommand(s *schema.Schema) gohanCommand { |
| 182 | return gohanCommand{ |
no test coverage detected