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