github.com/emc-advanced-dev/unik@v0.0.0-20190717152701-a58d3e8e33b7/pkg/providers/photon/delete_image.go (about) 1 package photon 2 3 import ( 4 "github.com/emc-advanced-dev/pkg/errors" 5 ) 6 7 func (p *PhotonProvider) DeleteImage(id string, force bool) error { 8 image, err := p.GetImage(id) 9 if err != nil { 10 return errors.New("image does not exist", err) 11 } 12 13 task, err := p.client.Images.Delete(image.Id) 14 if err != nil { 15 return errors.New("Delete image", err) 16 } 17 18 task, err = p.waitForTaskSuccess(task) 19 if err != nil { 20 return errors.New("Delete image", err) 21 } 22 23 return p.state.RemoveImage(image) 24 }