Esempio n. 1
0
func (command *commandDelete) Execute(resource *handler.Resource) {
	params := resource.Params.(*paramsDelete)
	imageID := params.imageID
	err := osImages.Delete(command.Ctx.ServiceClient, imageID).ExtractErr()
	if err != nil {
		resource.Err = err
		return
	}

	if params.wait {
		i := 0
		for i < 120 {
			_, err := images.Get(command.Ctx.ServiceClient, imageID).Extract()
			if err != nil {
				break
			}
			time.Sleep(5 * time.Second)
			i++
		}
		resource.Result = fmt.Sprintf("Deleted image [%s]", imageID)
	} else {
		resource.Result = fmt.Sprintf("Deleting instance [%s]\n", imageID)
	}
}
Esempio n. 2
0
// Get acquires additional detail about a specific image by ID.
func Get(client *gophercloud.ServiceClient, id string) os.GetResult {
	return os.Get(client, id)
}