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) }
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) } }
// Delete will delete the existing Snapshot with the provided ID. func Delete(client *gophercloud.ServiceClient, id string) os.DeleteResult { return os.Delete(client, id) }