github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/image/v2/images/Delete.go (about)

     1  package images
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  type DeleteImageOpts struct {
     9  	ImageId string `json:"-" required:"true"`
    10  	// Specifies whether to delete the CSBS backups or CBR backups associated with a full-ECS image when the image is deleted. The value can be true or false.
    11  	// true: When a full-ECS image is deleted, its CSBS backups or CBR backups are also deleted.
    12  	// false: When a full-ECS image is deleted, its CSBS backups or CBR backups are not deleted.
    13  	DeleteBackup bool `json:"delete_backup,omitempty"`
    14  }
    15  
    16  func Delete(client *golangsdk.ServiceClient, opts DeleteImageOpts) (err error) {
    17  	b, err := build.RequestBody(opts, "")
    18  	if err != nil {
    19  		return
    20  	}
    21  
    22  	// DELETE /v2/images/{image_id}
    23  	_, err = client.DeleteWithBody(client.ServiceURL("images", opts.ImageId), b, nil)
    24  	return
    25  }