Jon Perritt | 0ce24ad | 2014-10-20 21:59:45 -0500 | [diff] [blame] | 1 | package bulk |
| 2 | |
| 3 | import ( |
Jon Perritt | 260e088 | 2014-10-20 23:31:23 -0500 | [diff] [blame] | 4 | "github.com/rackspace/gophercloud" |
Jon Perritt | 0ce24ad | 2014-10-20 21:59:45 -0500 | [diff] [blame] | 5 | |
Jon Perritt | 260e088 | 2014-10-20 23:31:23 -0500 | [diff] [blame] | 6 | "github.com/mitchellh/mapstructure" |
| 7 | ) |
Jon Perritt | 0ce24ad | 2014-10-20 21:59:45 -0500 | [diff] [blame] | 8 | |
Jon Perritt | 260e088 | 2014-10-20 23:31:23 -0500 | [diff] [blame] | 9 | // DeleteResult represents the result of a bulk delete operation. |
Jon Perritt | 0ce24ad | 2014-10-20 21:59:45 -0500 | [diff] [blame] | 10 | type DeleteResult struct { |
| 11 | gophercloud.Result |
| 12 | } |
| 13 | |
Jon Perritt | 260e088 | 2014-10-20 23:31:23 -0500 | [diff] [blame] | 14 | // DeleteRespBody is the form of the response body returned by a bulk delete request. |
| 15 | type DeleteRespBody struct { |
| 16 | NumberNotFound int `mapstructure:"Number Not Found"` |
| 17 | ResponseStatus string `mapstructure:"Response Status"` |
| 18 | Errors []string `mapstructure:"Errors"` |
| 19 | NumberDeleted int `mapstructure:"Number Deleted"` |
| 20 | ResponseBody string `mapstructure:"Response Body"` |
Jon Perritt | 0ce24ad | 2014-10-20 21:59:45 -0500 | [diff] [blame] | 21 | } |
| 22 | |
Jon Perritt | 260e088 | 2014-10-20 23:31:23 -0500 | [diff] [blame] | 23 | // ExtractBody will extract the body returned by the bulk extract request. |
| 24 | func (dr DeleteResult) ExtractBody() (DeleteRespBody, error) { |
| 25 | var resp DeleteRespBody |
| 26 | err := mapstructure.Decode(dr.Body, &resp) |
| 27 | return resp, err |
Jon Perritt | 0ce24ad | 2014-10-20 21:59:45 -0500 | [diff] [blame] | 28 | } |