github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dis/v2/dump/ListTransferTasks.go (about)

     1  package dump
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  )
     7  
     8  func ListTransferTasks(client *golangsdk.ServiceClient, streamName string) (*ListTransferTasksResponse, error) {
     9  	// GET /v2/{project_id}/streams/{stream_name}/transfer-tasks
    10  	raw, err := client.Get(client.ServiceURL("streams", streamName, "transfer-tasks"), nil, nil)
    11  	if err != nil {
    12  		return nil, err
    13  	}
    14  
    15  	var res ListTransferTasksResponse
    16  	err = extract.Into(raw.Body, &res)
    17  	return &res, err
    18  }
    19  
    20  type ListTransferTasksResponse struct {
    21  	// Total number of dump tasks.
    22  	TotalNumber *int `json:"total_number,omitempty"`
    23  	// List of dump tasks.
    24  	Tasks []TransferTask `json:"tasks,omitempty"`
    25  }
    26  
    27  type TransferTask struct {
    28  	// Name of the dump task.
    29  	TaskName string `json:"task_name,omitempty"`
    30  	// Id of the dump task
    31  	TaskId string `json:"task_id,omitempty"`
    32  	// Dump task status. Possible values:
    33  	// ERROR: An error occurs.
    34  	// STARTING: The dump task is being started.
    35  	// PAUSED: The dump task has been stopped.
    36  	// RUNNING: The dump task is running.
    37  	// DELETE: The dump task has been deleted.
    38  	// ABNORMAL: The dump task is abnormal.
    39  	// Enumeration values:
    40  	// ERROR
    41  	// STARTING
    42  	// PAUSED
    43  	// RUNNING
    44  	// DELETE
    45  	// ABNORMAL
    46  	State string `json:"state,omitempty"`
    47  	// Dump destination. Possible values:
    48  	// OBS: Data is dumped to OBS.
    49  	// Enumeration values:
    50  	// OBS
    51  	DestinationType string `json:"destination_type,omitempty"`
    52  	// Time when the dump task is created.
    53  	CreatedAt *int64 `json:"create_time,omitempty"`
    54  	// Latest dump time of the dump task.
    55  	LastTransferTimestamp *int64 `json:"last_transfer_timestamp,omitempty"`
    56  }