예제 #1
0
파일: delete.go 프로젝트: nelsnelson/rack
func (command *commandDelete) Execute(resource *handler.Resource) {
	snapshotID := resource.Params.(*paramsDelete).snapshotID
	err := osSnapshots.Delete(command.Ctx.ServiceClient, snapshotID).ExtractErr()
	if err != nil {
		resource.Err = err
		return
	}
	resource.Result = fmt.Sprintf("Deleting snapshot [%s]\n", snapshotID)
}
예제 #2
0
func (command *commandDelete) Execute(resource *handler.Resource) {
	snapshotID := resource.Params.(*paramsDelete).snapshotID
	err := osSnapshots.Delete(command.Ctx.ServiceClient, snapshotID).ExtractErr()
	if err != nil {
		resource.Err = err
		return
	}

	if resource.Params.(*paramsDelete).wait {
		i := 0
		for i < 120 {
			_, err := osSnapshots.Get(command.Ctx.ServiceClient, snapshotID).Extract()
			if err != nil {
				break
			}
			time.Sleep(5 * time.Second)
			i++
		}
		resource.Result = fmt.Sprintf("Deleted snapshot [%s]\n", snapshotID)
	} else {
		resource.Result = fmt.Sprintf("Deleting snapshot [%s]\n", snapshotID)
	}
}
예제 #3
0
// Delete will delete the existing Snapshot with the provided ID.
func Delete(client *gophercloud.ServiceClient, id string) os.DeleteResult {
	return os.Delete(client, id)
}