github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dis/v2/dump/TransferTaskAction.go (about) 1 package dump 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/build" 6 ) 7 8 type TransferTaskActionOpts struct { 9 // Name of the stream to be queried. 10 // Maximum: 60 11 StreamName string `json:"stream_name"` 12 // Dump task operation. 13 // Currently, only the following operation is supported: 14 // - stop: The dump task is stopped. 15 // Enumeration values: 16 // stop 17 // - start: The dump task is started. 18 // Enumeration values: 19 // start 20 Action string `json:"action"` 21 // List of dump tasks to be paused. 22 Tasks []BatchTransferTask `json:"tasks"` 23 } 24 25 type BatchTransferTask struct { 26 // Dump task ID. 27 Id string `json:"id"` 28 } 29 30 func TransferTaskAction(client *golangsdk.ServiceClient, opts TransferTaskActionOpts) error { 31 b, err := build.RequestBody(opts, "") 32 if err != nil { 33 return err 34 } 35 36 // POST /v2/{project_id}/streams/{stream_name}/transfer-tasks/action 37 _, err = client.Post(client.ServiceURL("streams", opts.StreamName, "transfer-tasks", "action"), b, nil, &golangsdk.RequestOpts{ 38 OkCodes: []int{200}, 39 }) 40 return err 41 }