github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/drs/v3/public/BatchDeleteTasks.go (about) 1 package public 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/build" 6 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 7 ) 8 9 type BatchDeleteTasksOpts struct { 10 Jobs []DeleteJobReq `json:"jobs"` 11 } 12 13 type DeleteJobReq struct { 14 // The value can be terminated, force_terminate, or delete. terminate indicates that the migration task is stopped, 15 // force_terminate indicates that the migration task is forcibly stopped, and delete indicates that the migration task is deleted. 16 // Values: terminate force_terminate delete 17 DeleteType string `json:"delete_type"` 18 // Task ID. 19 JobId string `json:"job_id"` 20 } 21 22 type BatchDeleteJobsResponse struct { 23 Results []IdJobResp `json:"results,omitempty"` 24 Count int `json:"count,omitempty"` 25 } 26 27 func BatchDeleteTasks(client *golangsdk.ServiceClient, opts BatchDeleteTasksOpts) (*BatchTasksResponse, error) { 28 b, err := build.RequestBody(opts, "") 29 if err != nil { 30 return nil, err 31 } 32 33 // DELETE /v3/{project_id}/jobs/batch-jobs 34 raw, err := client.DeleteWithBody(client.ServiceURL("jobs", "batch-jobs"), b, nil) 35 if err != nil { 36 return nil, err 37 } 38 39 var res BatchTasksResponse 40 err = extract.Into(raw.Body, &res) 41 return &res, err 42 }