| Jon Perritt | fa2c65e | 2014-10-02 20:32:43 -0500 | [diff] [blame] | 1 | package snapshots |
| 2 | |||||
| 3 | import ( | ||||
| 4 | "github.com/rackspace/gophercloud" | ||||
| 5 | ) | ||||
| 6 | |||||
| 7 | func WaitForStatus(c *gophercloud.ServiceClient, id, status string, secs int) error { | ||||
| 8 | return gophercloud.WaitFor(secs, func() (bool, error) { | ||||
| 9 | current, err := Get(c, id).Extract() | ||||
| 10 | if err != nil { | ||||
| 11 | return false, err | ||||
| 12 | } | ||||
| 13 | |||||
| 14 | if current.Status == status { | ||||
| 15 | return true, nil | ||||
| 16 | } | ||||
| 17 | |||||
| 18 | return false, nil | ||||
| 19 | }) | ||||
| 20 | } | ||||